Skip to content

python-challenge-3 solved #77

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

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
10 changes: 8 additions & 2 deletions projects/challenge/smart_contracts/asa_vault/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ def authorize_creator(self) -> None:
def opt_in_to_asset(self, mbr_pay: gtxn.PaymentTransaction) -> None:
self.authorize_creator()
assert not Global.current_application_address.is_opted_in(Asset(self.asset_id))
itxn.AssetTransfer(
xfer_asset=self.asset_id,
asset_receiver=Global.current_application_address,
sender=Global.current_application_address,
asset_amount=0,
fee=0,
).submit()

assert mbr_pay.receiver == Global.current_application_address
assert mbr_pay.amount == Global.min_balance + Global.asset_opt_in_min_balance

@arc4.abimethod
def deposit_asa(self, deposit_txn: gtxn.AssetTransferTransaction)-> None:
self.authorize_creator()
Expand All @@ -47,4 +54,3 @@ def withdraw_asa(self, asset: Asset) -> None:
@arc4.abimethod(readonly=True)
def get_asa_balance(self) -> UInt64:
return self.asa_balance