Skip to content

Commit

Permalink
ABI Types (#154)
Browse files Browse the repository at this point in the history
* initial commit to be used for reference and comparison

* Fmt

* move abi to ast

* make tuple return the deocded Tuple

* rename collections, fixed some of the mypy issues

* Fix mypy issues

* remove Literal

* add str method for abi type names

* fix names

* make imports nice

* make imports nice

* make collections generic

* rm param spec

* lie to mypy

* make dynamic array work

* [WIP] Make Add and Mul NaryExprs

* ABI refactor

* Implement decoding

* Make arrays encode to a single value

* Make types mutable

* Proof of concept map implementation

* Remove old comment

* Update Uint16 limit check

Co-authored-by: Giorgio Ciotti <gciotti.dev@gmail.com>

* provide a method to know the type name (#176)

* Refactor array implementation

* Add ComputedType and fix bug in map

* Add more int types and bool support

* Add string method

* Remove files for features that won't make it into this PR

* Remove Array.map 😢

* Make decode more powerful

* Uint bounds checking and tests

* Remove random line

* Bool tests and bugfixes

* Allow uint and bool set to copy another type

* Begin tuple and array tests, improve dynamic tuple encoding, and remove Array.forEach

* Test indexTuple and fix bugs

* Fix field shadowing

* Finish tuple tests and type tests

* Implement static and dynamic array tests

* Finish testing abi types and fix tuple encoding bug

* Add generic param to new instances of arrays

* Address feedback

* Fix tuple decoding issue

* Fix uint64 decoding test

* minor improvement to distinguish abi.Byte and abi.Uint8 (#194)

* Add docstrings to abi.Type

* Respond to feedback

* Respond to feedback & fix bug

* Fix indexTuple bug

* Add docs for TealBlock methods

* ABI Array docstrings and comments (#216)

Co-authored-by: Jason Paulos <jasonpaulos@users.noreply.github.com>
Co-authored-by: Giorgio Ciotti <gciotti.dev@gmail.com>
Co-authored-by: Hang Su <87964331+ahangsu@users.noreply.github.com>
  • Loading branch information
4 people authored Mar 1, 2022
1 parent 262ffc7 commit 3b386b0
Show file tree
Hide file tree
Showing 21 changed files with 3,707 additions and 77 deletions.
1 change: 1 addition & 0 deletions pyteal/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ __all__ = [
"For",
"Break",
"Continue",
"abi",
"Op",
"Mode",
"TealComponent",
Expand Down
8 changes: 5 additions & 3 deletions pyteal/ast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@
# binary ops
from .binaryexpr import (
BinaryExpr,
Add,
Minus,
Mul,
Div,
Mod,
Exp,
Expand Down Expand Up @@ -96,7 +94,7 @@
from .substring import Substring, Extract, Suffix

# more ops
from .naryexpr import NaryExpr, And, Or, Concat
from .naryexpr import NaryExpr, Add, Mul, And, Or, Concat
from .widemath import WideRatio

# control flow
Expand Down Expand Up @@ -125,6 +123,9 @@
from .maybe import MaybeValue
from .multi import MultiValue

# abi
from . import abi

__all__ = [
"Expr",
"LeafExpr",
Expand Down Expand Up @@ -257,4 +258,5 @@
"For",
"Break",
"Continue",
"abi",
]
20 changes: 20 additions & 0 deletions pyteal/ast/abi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from .type import Type, ComputedType
from .bool import Bool
from .uint import Uint, Byte, Uint8, Uint16, Uint32, Uint64
from .tuple import Tuple
from .array import StaticArray, DynamicArray

__all__ = [
"Type",
"ComputedType",
"Bool",
"Uint",
"Byte",
"Uint8",
"Uint16",
"Uint32",
"Uint64",
"Tuple",
"StaticArray",
"DynamicArray",
]
Loading

0 comments on commit 3b386b0

Please sign in to comment.