Skip to content

Commit fc3d2a4

Browse files
authored
Merge pull request #4 from algorand-devrel/pyteal-abi
PyTeal ABI support
2 parents 02765c8 + 64dba29 commit fc3d2a4

File tree

10 files changed

+891
-761
lines changed

10 files changed

+891
-761
lines changed

approval.teal

Lines changed: 498 additions & 433 deletions
Large diffs are not rendered by default.

clear.teal

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
#pragma version 5
2-
pushint 1 // 1
1+
#pragma version 6
2+
txn NumAppArgs
3+
int 0
4+
==
5+
bnz main_l2
6+
err
7+
main_l2:
8+
int 1
39
return

contract.json

Lines changed: 224 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,249 @@
11
{
2-
"name":"demo-abi",
3-
"networks":{
4-
"default":{
5-
"appID": 1
2+
"name": "demo-abi",
3+
"methods": [
4+
{
5+
"name": "add",
6+
"args": [
7+
{
8+
"type": "uint64",
9+
"name": "a"
10+
},
11+
{
12+
"type": "uint64",
13+
"name": "b"
14+
}
15+
],
16+
"returns": {
17+
"type": "uint64"
18+
}
19+
},
20+
{
21+
"name": "sub",
22+
"args": [
23+
{
24+
"type": "uint64",
25+
"name": "a"
26+
},
27+
{
28+
"type": "uint64",
29+
"name": "b"
30+
}
31+
],
32+
"returns": {
33+
"type": "uint64"
34+
}
35+
},
36+
{
37+
"name": "mul",
38+
"args": [
39+
{
40+
"type": "uint64",
41+
"name": "a"
42+
},
43+
{
44+
"type": "uint64",
45+
"name": "b"
46+
}
47+
],
48+
"returns": {
49+
"type": "uint64"
50+
}
51+
},
52+
{
53+
"name": "div",
54+
"args": [
55+
{
56+
"type": "uint64",
57+
"name": "a"
58+
},
59+
{
60+
"type": "uint64",
61+
"name": "b"
62+
}
63+
],
64+
"returns": {
65+
"type": "uint64"
66+
}
67+
},
68+
{
69+
"name": "mod",
70+
"args": [
71+
{
72+
"type": "uint64",
73+
"name": "a"
74+
},
75+
{
76+
"type": "uint64",
77+
"name": "b"
78+
}
79+
],
80+
"returns": {
81+
"type": "uint64"
82+
}
83+
},
84+
{
85+
"name": "qrem",
86+
"args": [
87+
{
88+
"type": "uint64",
89+
"name": "a"
90+
},
91+
{
92+
"type": "uint64",
93+
"name": "b"
94+
}
95+
],
96+
"returns": {
97+
"type": "(uint64,uint64)"
98+
}
99+
},
100+
{
101+
"name": "reverse",
102+
"args": [
103+
{
104+
"type": "string",
105+
"name": "a"
6106
}
107+
],
108+
"returns": {
109+
"type": "string"
110+
}
7111
},
8-
"methods":[
112+
{
113+
"name": "concat_strings",
114+
"args": [
9115
{
10-
"name":"add",
11-
"desc":"Add 2 integers",
12-
"args":[ { "type":"uint64" }, { "type":"uint64" } ],
13-
"returns": {"type":"uint64"}
116+
"type": "string[]",
117+
"name": "b"
118+
}
119+
],
120+
"returns": {
121+
"type": "string"
122+
},
123+
"desc": "concats strings sometimes does other stuff"
124+
},
125+
{
126+
"name": "manyargs",
127+
"args": [
128+
{
129+
"type": "uint64",
130+
"name": "a"
131+
},
132+
{
133+
"type": "uint64",
134+
"name": "b"
135+
},
136+
{
137+
"type": "uint64",
138+
"name": "c"
139+
},
140+
{
141+
"type": "uint64",
142+
"name": "d"
143+
},
144+
{
145+
"type": "uint64",
146+
"name": "e"
147+
},
148+
{
149+
"type": "uint64",
150+
"name": "f"
151+
},
152+
{
153+
"type": "uint64",
154+
"name": "g"
14155
},
15156
{
16-
"name":"sub",
17-
"desc":"Subtract 2 integers",
18-
"args":[ { "type":"uint64" }, { "type":"uint64" } ],
19-
"returns": {"type":"uint64"}
157+
"type": "uint64",
158+
"name": "h"
20159
},
21160
{
22-
"name":"mul",
23-
"desc":"Multiply 2 integers",
24-
"args":[ { "type":"uint64" }, { "type":"uint64" } ],
25-
"returns": {"type":"uint64"}
161+
"type": "uint64",
162+
"name": "i"
26163
},
27164
{
28-
"name":"div",
29-
"desc":"Divide 2 integers, throw away the remainder",
30-
"args":[ { "type":"uint64" }, { "type":"uint64" } ],
31-
"returns": {"type":"uint64"}
165+
"type": "uint64",
166+
"name": "j"
32167
},
33168
{
34-
"name":"qrem",
35-
"desc":"Divide 2 integers, return both the quotient and remainder",
36-
"args":[ { "type":"uint64" }, { "type":"uint64" } ],
37-
"returns": {"type":"(uint64,uint64)"}
169+
"type": "uint64",
170+
"name": "k"
38171
},
39172
{
40-
"name":"reverse",
41-
"desc":"Reverses a string",
42-
"args":[ { "type":"string" } ],
43-
"returns": {"type":"string"}
173+
"type": "uint64",
174+
"name": "l"
44175
},
45176
{
46-
"name":"txntest",
47-
"desc":"just check it",
48-
"args":[{"type":"uint64"}, {"type": "pay"}, {"type":"uint64"}],
49-
"returns":{"type": "uint64"}
177+
"type": "uint64",
178+
"name": "m"
50179
},
51180
{
52-
"name":"concat_strings",
53-
"desc":"concat some strings",
54-
"args":[{"type":"string[]"}],
55-
"returns":{"type": "string"}
181+
"type": "uint64",
182+
"name": "n"
56183
},
57184
{
58-
"name":"manyargs",
59-
"desc":"Try to send 20 arguments",
60-
"args":[
61-
{"type":"uint64"}, {"type": "uint64"}, {"type":"uint64"},{"type":"uint64"},
62-
{"type":"uint64"}, {"type": "uint64"}, {"type":"uint64"},{"type":"uint64"},
63-
{"type":"uint64"}, {"type": "uint64"}, {"type":"uint64"},{"type":"uint64"},
64-
{"type":"uint64"}, {"type": "uint64"}, {"type":"uint64"},{"type":"uint64"},
65-
{"type":"uint64"}, {"type": "uint64"}, {"type":"uint64"},{"type":"uint64"}
66-
],
67-
"returns":{"type": "uint64"}
185+
"type": "uint64",
186+
"name": "o"
187+
},
188+
{
189+
"type": "uint64",
190+
"name": "p"
191+
},
192+
{
193+
"type": "uint64",
194+
"name": "q"
195+
},
196+
{
197+
"type": "uint64",
198+
"name": "r"
199+
},
200+
{
201+
"type": "uint64",
202+
"name": "s"
203+
},
204+
{
205+
"type": "uint64",
206+
"name": "t"
207+
}
208+
],
209+
"returns": {
210+
"type": "uint64"
211+
},
212+
"desc": "Lots of args here"
213+
},
214+
{
215+
"name": "min_bal",
216+
"args": [
217+
{
218+
"type": "account",
219+
"name": "acct"
220+
}
221+
],
222+
"returns": {
223+
"type": "uint64"
224+
}
225+
},
226+
{
227+
"name": "txntest",
228+
"args": [
229+
{
230+
"type": "uint64",
231+
"name": "amt"
68232
},
69233
{
70-
"name":"min_bal",
71-
"desc":"Get the minimum balance for given account",
72-
"args":[
73-
{"type":"account"}
74-
],
75-
"returns":{"type":"uint64"}
234+
"type": "pay",
235+
"name": "ptxn"
76236
},
77237
{
78-
"name":"tupler",
79-
"desc":"",
80-
"args":[
81-
{"type":"(string,uint64,string)"}
82-
],
83-
"returns":{"type":"uint64"}
238+
"type": "uint64",
239+
"name": "fee"
84240
}
85-
]
86-
}
241+
],
242+
"returns": {
243+
"type": "uint64"
244+
}
245+
}
246+
],
247+
"desc": null,
248+
"networks": {}
249+
}

0 commit comments

Comments
 (0)