-
Notifications
You must be signed in to change notification settings - Fork 9
/
contract.py
32 lines (24 loc) · 931 Bytes
/
contract.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from algopy import Contract, UInt64, log, op, uenumerate, urange
LOOP_ITERATIONS = 2 # max op code budget is exceeded with more
class Nested(Contract):
def approval_program(self) -> UInt64:
n = UInt64(LOOP_ITERATIONS)
x = UInt64(0)
for a in urange(n):
for b in urange(n):
for c in urange(n):
for d in urange(n):
for e in urange(n):
for f in urange(n):
x += a + b + c + d + e + f
# Iterator variable should be mutable, but mutating it
# should not affect the next iteration
a += n
log(op.itob(x))
y = UInt64(0)
for index, item in uenumerate(urange(UInt64(10))):
y += item * index
log(op.itob(y))
return x
def clear_state_program(self) -> UInt64:
return UInt64(1)