Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
7ac246b
first cut
Feb 2, 2022
d0a9e98
Update pyteal/ast/subroutine_test.py
tzaffi Feb 2, 2022
84eb656
lint
Feb 2, 2022
32855a7
unused import
Feb 2, 2022
1be9ffd
better unit test
Feb 2, 2022
63ee75f
pass on circle too
Feb 2, 2022
d4c03bf
async issue on circle???
Feb 2, 2022
6d4e00c
pass partial annotations case
Feb 2, 2022
707c67c
lint
Feb 2, 2022
e585c70
handle ScratchVar and Expr subtypes for the return
Feb 2, 2022
c284da2
mypy
Feb 2, 2022
c42f6d2
error massaging
Feb 2, 2022
5b4d9e0
better error message
Feb 2, 2022
c5fbbdc
Merge remote-tracking branch 'origin' into stores-loads
Feb 2, 2022
7143e43
tuple not list
Feb 2, 2022
fdd5040
pass tests on travis (enums treated differently between python versions)
Feb 2, 2022
77ea79e
travis be nice
Feb 2, 2022
236c837
partial skeleton
Feb 3, 2022
780f68e
loadSlotidFromStack --> slodIdFromStack
Feb 3, 2022
d4448a8
another test case for init ScratchSlot
Feb 3, 2022
113b215
make mypy happy, but I'm not sure I am...
Feb 3, 2022
dded740
fromStack --> slotIdFromStack
Feb 3, 2022
fd2dcbf
per CR
Feb 3, 2022
70968f4
Update pyteal/ast/scratchvar.py
tzaffi Feb 4, 2022
072ad1e
Merge branch 'stores-loads' of github.com:algorand/pyteal into stores…
Feb 4, 2022
9205cf3
DynamicSlot
Feb 4, 2022
32a4fce
doc wording
Feb 7, 2022
421e841
unit tests passing, but need lots more
Feb 7, 2022
9b23e43
close, but still need stack variables before subroutine call
Feb 7, 2022
13b238f
looks like it's working. Next: cleanup + tests
Feb 8, 2022
c05437a
nope before - but now can pass-by-ref non-duynamic as well
Feb 8, 2022
4a96878
clean up
Feb 8, 2022
ed673ce
revert withDynamic param
Feb 8, 2022
5fc470a
less wrong comment
Feb 8, 2022
86a3771
uncomment clear
Feb 8, 2022
d3e00b7
TDD: 'ScratchVar' object has no attribute 'Index'
Feb 8, 2022
5fb32e8
start cleanup
Feb 8, 2022
e3876cb
spacing/reorder imports
Feb 8, 2022
ae7c811
unused imports
Feb 9, 2022
3c81ad1
remove dead branch
Feb 9, 2022
ef0250b
as name suggests, subroutineInternal should be internal
Feb 9, 2022
2e6ba74
test cases
Feb 9, 2022
4a5a68c
unnneeded variable
Feb 9, 2022
92598b0
easier diff
Feb 9, 2022
c0dbc52
update error messages
Feb 9, 2022
ab38218
comment
Feb 9, 2022
1399e09
question comments
Feb 9, 2022
351d3c9
Merge branch 'master' of github.com:algorand/pyteal into stores-loads
Feb 10, 2022
2fda6c2
ugly commit, but saving my work at a good spot
Feb 10, 2022
1c0498a
it works... but major cleanup necessary and need to support implicit …
Feb 11, 2022
e48be41
helpers in UnaryExpr
Feb 11, 2022
b17fa15
allow more general types
Feb 11, 2022
39ae893
don't need the extra swap anymore
Feb 11, 2022
20e3117
easier API
Feb 11, 2022
eb8e743
better comment
Feb 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/control_structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,17 @@ Subroutines
.. note::
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated doc changes.

Subroutines are only available in TEAL version 4 or higher.

A subroutine is section of code that can be called multiple times from within a program. Subroutines
are PyTeal's equivalent to functions. Subroutines can accept any number of arguments, and these
arguments must be PyTeal expressions. Additionally, a subroutine may return a single value, or no value.
A subroutine is a section of code that can be called multiple times from within a program.
Subroutines are PyTeal's equivalent to functions. Subroutines can accept any number of arguments which must be PyTeal expressions.
Additionally, a subroutine may return a single value, or no value.

Creating Subroutines
--------------------

To create a subroutine, apply the :any:`Subroutine` function decorator to a Python function which
implements the subroutine. This decorator takes one argument, which is the return type of the subroutine.
:any:`TealType.none` indicates that the subroutine does not return a value, and any other type
(e.g. :any:`TealType.uint64` or :any:`TealType.bytes`) indicates the return type of the single value
implements the subroutine. This decorator takes one argument -the return type of the subroutine.
:any:`TealType.none` indicates that the subroutine does not return a value, and another type
(e.g. :any:`TealType.uint64`, :any:`TealType.bytes`) indicates the return type of the single value
the subroutine returns.

For example,
Expand Down
3 changes: 0 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ PyTeal is a Python language binding for `Algorand Smart Contracts (ASC1s) <https

Algorand Smart Contracts are implemented using a new language that is stack-based,
called `Transaction Execution Approval Language (TEAL) <https://developer.algorand.org/docs/teal>`_.
This a non-Turing complete language that allows branch forwards but prevents recursive logic
to maximize safety and performance.

However, TEAL is essentially an assembly language.
With PyTeal, developers can express smart contract logic purely using Python.
PyTeal provides high level, functional programming style abstactions over TEAL
and does type checking at construction time.
Expand Down
Loading