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

과제 제출 #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ main_opt_in_to_app_route@4:
return

main_deposit_route@5:
// smart_contracts/personal_bank/contract.py:18
// smart_contracts/personal_bank/contract.py:19
// @arc4.abimethod
txn OnCompletion
!
Expand All @@ -48,7 +48,7 @@ main_deposit_route@5:
int pay
==
assert // transaction type is pay
// smart_contracts/personal_bank/contract.py:18
// smart_contracts/personal_bank/contract.py:19
// @arc4.abimethod
callsub deposit
itob
Expand All @@ -60,7 +60,7 @@ main_deposit_route@5:
return

main_withdraw_route@6:
// smart_contracts/personal_bank/contract.py:32
// smart_contracts/personal_bank/contract.py:35
// @arc4.abimethod(allow_actions=["CloseOut"])
txn OnCompletion
int CloseOut
Expand Down Expand Up @@ -97,7 +97,7 @@ opt_in_to_app:
// def opt_in_to_app(self) -> None:
proto 0 0
// smart_contracts/personal_bank/contract.py:12
// result , exists = self.optedIn.maybe(Txn.sender)
// result, exists = self.optedIn.maybe(Txn.sender)
txn Sender
int 0
byte "optedIn"
Expand All @@ -107,19 +107,19 @@ opt_in_to_app:
// assert not exists, "User already opted in"
!
assert // User already opted in
// smart_contracts/personal_bank/contract.py:14
// smart_contracts/personal_bank/contract.py:15
// self.balance[Txn.sender] = UInt64(0)
txn Sender
byte "balance"
int 0
app_local_put
// smart_contracts/personal_bank/contract.py:15
// smart_contracts/personal_bank/contract.py:16
// self.optedIn[Txn.sender] = True
txn Sender
byte "optedIn"
int 1
app_local_put
// smart_contracts/personal_bank/contract.py:16
// smart_contracts/personal_bank/contract.py:17
// self.depositors += 1
int 0
byte "depositors"
Expand All @@ -135,41 +135,47 @@ opt_in_to_app:

// smart_contracts.personal_bank.contract.PersonalBank.deposit(ptxn: uint64) -> uint64:
deposit:
// smart_contracts/personal_bank/contract.py:18-19
// smart_contracts/personal_bank/contract.py:19-20
// @arc4.abimethod
// def deposit(self, ptxn: gtxn.PaymentTransaction) -> UInt64:
proto 1 1
// smart_contracts/personal_bank/contract.py:20
// smart_contracts/personal_bank/contract.py:21
// assert ptxn.amount > 0, "Deposit amount must be greater than 0"
frame_dig -1
gtxns Amount
dup
assert // Deposit amount must be greater than 0
// smart_contracts/personal_bank/contract.py:22
// smart_contracts/personal_bank/contract.py:23
// ptxn.receiver == Global.current_application_address
frame_dig -1
gtxns Receiver
global CurrentApplicationAddress
==
// smart_contracts/personal_bank/contract.py:21-23
// smart_contracts/personal_bank/contract.py:22-24
// assert (
// ptxn.receiver == Global.current_application_address
// ), "Deposit receiver must be the contract address"
assert // Deposit receiver must be the contract address
// smart_contracts/personal_bank/contract.py:24
// smart_contracts/personal_bank/contract.py:25
// assert ptxn.sender == Txn.sender, "Deposit sender must be the caller"
frame_dig -1
gtxns Sender
txn Sender
==
assert // Deposit sender must be the caller
// smart_contracts/personal_bank/contract.py:25
// assert Txn.sender.is_opted_in(Global.current_application_id), "Deposit sender must opt-in to the app first."
// smart_contracts/personal_bank/contract.py:26
// assert Txn.sender.is_opted_in(
txn Sender
// smart_contracts/personal_bank/contract.py:27
// Global.current_application_id
global CurrentApplicationID
// smart_contracts/personal_bank/contract.py:26-28
// assert Txn.sender.is_opted_in(
// Global.current_application_id
// ), "Deposit sender must opt-in to the app first."
app_opted_in
assert // Deposit sender must opt-in to the app first.
// smart_contracts/personal_bank/contract.py:27
// smart_contracts/personal_bank/contract.py:30
// self.balance[Txn.sender] += ptxn.amount
txn Sender
int 0
Expand All @@ -181,74 +187,74 @@ deposit:
byte "balance"
uncover 2
app_local_put
// smart_contracts/personal_bank/contract.py:28
// smart_contracts/personal_bank/contract.py:31
// user_balance = self.balance[Txn.sender]
txn Sender
int 0
byte "balance"
app_local_get_ex
assert // check balance exists for account
// smart_contracts/personal_bank/contract.py:30
// smart_contracts/personal_bank/contract.py:33
// return user_balance
retsub


// smart_contracts.personal_bank.contract.PersonalBank.withdraw() -> uint64:
withdraw:
// smart_contracts/personal_bank/contract.py:32-33
// smart_contracts/personal_bank/contract.py:35-36
// @arc4.abimethod(allow_actions=["CloseOut"])
// def withdraw(self) -> UInt64:
proto 0 1
// smart_contracts/personal_bank/contract.py:34
// smart_contracts/personal_bank/contract.py:37
// assert self.balance[Txn.sender] > 0, "User balance must be greater than 0"
txn Sender
int 0
byte "balance"
app_local_get_ex
assert // check balance exists for account
assert // User balance must be greater than 0
// smart_contracts/personal_bank/contract.py:36
// smart_contracts/personal_bank/contract.py:39
// userBalance = self.balance[Txn.sender]
txn Sender
int 0
byte "balance"
app_local_get_ex
assert // check balance exists for account
// smart_contracts/personal_bank/contract.py:38-43
// smart_contracts/personal_bank/contract.py:41-46
// itxn.Payment(
// receiver=Txn.sender,
// sender=Global.current_application_address,
// amount=userBalance,
// fee=0,
// ).submit()
itxn_begin
// smart_contracts/personal_bank/contract.py:39
// smart_contracts/personal_bank/contract.py:42
// receiver=Txn.sender,
txn Sender
// smart_contracts/personal_bank/contract.py:40
// smart_contracts/personal_bank/contract.py:43
// sender=Global.current_application_address,
global CurrentApplicationAddress
dig 2
itxn_field Amount
itxn_field Sender
itxn_field Receiver
// smart_contracts/personal_bank/contract.py:38
// smart_contracts/personal_bank/contract.py:41
// itxn.Payment(
int pay
itxn_field TypeEnum
// smart_contracts/personal_bank/contract.py:42
// smart_contracts/personal_bank/contract.py:45
// fee=0,
int 0
itxn_field Fee
// smart_contracts/personal_bank/contract.py:38-43
// smart_contracts/personal_bank/contract.py:41-46
// itxn.Payment(
// receiver=Txn.sender,
// sender=Global.current_application_address,
// amount=userBalance,
// fee=0,
// ).submit()
itxn_submit
// smart_contracts/personal_bank/contract.py:45
// smart_contracts/personal_bank/contract.py:48
// self.depositors -= 1
int 0
byte "depositors"
Expand All @@ -259,7 +265,7 @@ withdraw:
byte "depositors"
swap
app_global_put
// smart_contracts/personal_bank/contract.py:47
// smart_contracts/personal_bank/contract.py:50
// return userBalance
retsub

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading