Last active
May 25, 2023 18:06
-
-
Save helderjnpinto/2416f4d5e3f0dc3349ee07d976e15536 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma version 8 | |
if Txn.ApplicationID == 0: | |
# Handle Create App | |
exit(1) | |
end | |
switch Txn.OnCompletion: | |
NoOp: main | |
OptIn: opt_in | |
CloseOut: close_out | |
UpdateApplication: update_app | |
DeleteApplication: delete_app | |
end | |
block opt_in: | |
# Handle Opt In | |
# some statements here | |
# exit(1) | |
# OR | |
# Disallow Opt In | |
exit(0) | |
end | |
block close_out: | |
# Handle Close Out | |
# some statements here | |
# exit(1) | |
# OR | |
# Disallow Closing Out | |
exit(0) | |
end | |
block update_app: | |
# Handle Update App | |
# Example: Only allow the Creator to update the app (useful during development) | |
exit(Txn.Sender == Global.CreatorAddress) | |
# OR | |
# Disallow Update App | |
# exit(0) | |
end | |
block delete_app: | |
# Handle Delete App | |
# Example: Only allow the Creator to update the app (useful during development) | |
exit(Txn.Sender == Global.CreatorAddress) | |
# OR | |
# Disallow Delete App | |
# exit(0) | |
end | |
block main: | |
switch Txn.ApplicationArgs[0]: | |
"method_a": method_a | |
end | |
block method_a: | |
exit(1) | |
end | |
end | |
func calc(from_round: int) int: | |
int end_round = Global.Round | |
if end_round > 10: | |
end_round = 10 | |
end | |
return end_round - from_round | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment