-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add extract expressions #118
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me, just had two questions:
- Will there be a way to force the
substring
orextract
TEAL op code using Pyteal (i.e. the ones that take immediates)? I guess there isn't much of a usecase right now, but those ops do save a couple bytes (assuming they are uint8) if I recall correctly. - There is a somewhat hidden shortcut in
extract
where if you specify the length to be0
as an immediate, it extracts until the end of the string. I think this is linked to point 1 and wondering if it should be supported.
I agree it would be nice if there was a way to generate the Normally if an operation can accept either a stack value or an immediate, PyTeal allows For Since there's a fair bit of complexity here, I think it would be better to address this in a separate issue. edit: I made an issue: #119 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that sounds good -- Yes the 0
length trick will only work with the immediates extract
opcode rather than the extract3
op code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚢
Adds expressions for using new TEAL 5 extract opcodes.