This forum is a read-only archive. Posting, replying and signing in are disabled.

PyTEAL: Loop load from scratch slots

hernandp

I’m finding problems in pyTEAL looping over scratch slots if ScratchVar(type, i) accepts int as a slot-id type but not Int. Is this possible?

# Clear slots loop

For(i.store(Int(0)), i.load() < num_slots, i.store(i.load() + Int(1))).Do(
            Seq([
                (ScratchVar(TealType.uint64, i.load())).store(Int(0))
            ]))

In pseudo this should conform to

FOR I = 0 TO NUM_SLOTS DO  
       STORE 0 -> SLOT(I)  
NEXT

This is solvable in current version?
At least is perfectly possible in TEAL5 by using looping and stores opcode.
Kind regards,

✔ Solved by fabrice in post #2
edited