Box Storage Support
(WIP)
Problem
Developers need to be able to use the new box storage from pyteal. We want to support:
- These opcodes:
- [x]
box_create - [x]
box_extract - [x]
box_replace - [x]
box_del - [x]
box_len - [x]
box_get - [x]
box_put
- [x]
Solution
Possible syntax and questions to consider:
App.boxAlloc(Bytes("box name"), Int())
- where the second argument is the size of box, in # of bytes (has limitations, should we check these at the pyteal layer?).
- Implicitly is passed the app ID as well, which is needed to reference the box.
App.boxPut(reference-to-location, value being put)
App.boxGet(reference-to-location)
App.boxDel(Bytes("box name"))
Application calls need to be able to specify boxes (i.e. I think TxnObject needs a "boxes" property Txn.boxes)
Cf. #353
Just one question to confirm:
Referencing which boxes will be used in an app call (analogous to foreign arrays)
I suppose this is not quite applicable in current design (as of 2022/08/10), where boxes are not directly viewable like foreign array. It is done by app-args to manipulate boxes. Then I wonder if my assumption is wrong, or this line needs to be changed?
@ahangsu I think the ticket had a stale description based. Like you're suggesting, there's no exposed go-algorand functionality to extend in pyteal. So, I updated to remove the line item.
@michaeldiamant Thanks for the description update!