Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions projects/challenge/smart_contracts/counter/contract.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# pyright: reportMissingModuleSource=false
from algopy import ARC4Contract, LocalState, GlobalState, UInt64, Txn, arc4, Global


class Counter(ARC4Contract):
count:LocalState[UInt64]
counters:GlobalState[UInt64]

count: LocalState[UInt64]
counters: GlobalState[UInt64]
def _init_(self) -> None:
self.count = LocalState(UInt64)
self.counters = GlobalState(UInt64(0))

@arc4.baremethod(allow_actions=["OptIn"])
def opt_in(self) -> None:
self.count[Txn.sender] = UInt64(0)
self.counters.value += 1

@arc4.abimethod()
def increment(self) -> arc4.UInt64:
assert Txn.sender.is_opted_in(
Expand Down