Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python-challenge-1 solved #89

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
5 changes: 3 additions & 2 deletions projects/challenge/smart_contracts/personal_vault/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ def opt_in_to_app(self) -> None:
def deposit(self, ptxn: gtxn.PaymentTransaction) -> UInt64:
assert ptxn.amount > 0, "Deposit amount must be greater than 0"
assert (
ptxn.receiver == Global.current_application_id
ptxn.receiver == Global.current_application_address
), "Deposit receiver must be the contract address"
assert ptxn.sender == Txn.sender, "Deposit sender must be the caller"
assert op.app_opted_in(
Txn.sender, Global.current_application_address
Txn.sender, Global.current_application_id
), "Deposit sender must opt-in to the app first."

self.balance[Txn.sender] += ptxn.amount
Expand All @@ -47,3 +47,4 @@ def withdraw(self) -> UInt64:
).submit()

return userBalance