memoscan
← all memos

Memo 0xb0e1afef…2891dc on Ethereum

# v0.1.0 # { "Depends": "py-genlayer:latest" } from genlayer import * class FootballScore(gl.Contract): team1_score: u256 = 0 team2_score: u256 = 0 match_active: bool = False def __init__(self): pass # No init params @gl.public.view def get_scores(self) -> str: return f"{self.team1_score}-{self.team2_score}" @gl.public.write def goal_team1(self) -> None: if not self.match_active: gl.revert("Match not started") self.team1_score += 1 @gl.public.write def goal_team2(self) -> None: if not self.match_active: gl.revert("Match not started") self.team2_score += 1 @gl.public.write def start_match(self) -> None: self.match_active = True self.team1_score = 0 self.team2_score = 0 @gl.public.write def end_match(self) -> None: self.match_active = False