Skip to content

Commit

Permalink
reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
iskysun96 committed May 27, 2024
1 parent 995304c commit e3df3c2
Show file tree
Hide file tree
Showing 16 changed files with 383 additions and 542 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ main_buy_route@5:
return

main_withdraw_and_delete_route@6:
// smart_contracts/nft_marketplace/contract.py:177
// smart_contracts/nft_marketplace/contract.py:176
// @arc4.abimethod(allow_actions=["DeleteApplication"])
txn OnCompletion
int DeleteApplication
Expand Down Expand Up @@ -241,37 +241,31 @@ buy:
*
==
assert
// smart_contracts/nft_marketplace/contract.py:139
// assert Txn.sender != Global.creator_address
txn Sender
global CreatorAddress
!=
assert
// smart_contracts/nft_marketplace/contract.py:141-145
// smart_contracts/nft_marketplace/contract.py:140-144
// itxn.AssetTransfer(
// xfer_asset=self.asset_id,
// asset_receiver=Txn.sender,
// asset_amount=quantity,
// ).submit()
itxn_begin
// smart_contracts/nft_marketplace/contract.py:142
// smart_contracts/nft_marketplace/contract.py:141
// xfer_asset=self.asset_id,
int 0
byte "asset_id"
app_global_get_ex
assert // check asset_id exists
// smart_contracts/nft_marketplace/contract.py:143
// smart_contracts/nft_marketplace/contract.py:142
// asset_receiver=Txn.sender,
txn Sender
frame_dig -1
itxn_field AssetAmount
itxn_field AssetReceiver
itxn_field XferAsset
// smart_contracts/nft_marketplace/contract.py:141
// smart_contracts/nft_marketplace/contract.py:140
// itxn.AssetTransfer(
int axfer
itxn_field TypeEnum
// smart_contracts/nft_marketplace/contract.py:141-145
// smart_contracts/nft_marketplace/contract.py:140-144
// itxn.AssetTransfer(
// xfer_asset=self.asset_id,
// asset_receiver=Txn.sender,
Expand All @@ -283,79 +277,79 @@ buy:

// smart_contracts.nft_marketplace.contract.NftMarketplace.withdraw_and_delete() -> uint64:
withdraw_and_delete:
// smart_contracts/nft_marketplace/contract.py:177-178
// smart_contracts/nft_marketplace/contract.py:176-177
// @arc4.abimethod(allow_actions=["DeleteApplication"])
// def withdraw_and_delete(self) -> UInt64:
proto 0 1
// smart_contracts/nft_marketplace/contract.py:179
// smart_contracts/nft_marketplace/contract.py:178
// assert Txn.sender == Global.creator_address
txn Sender
global CreatorAddress
==
assert
// smart_contracts/nft_marketplace/contract.py:180
// smart_contracts/nft_marketplace/contract.py:179
// contract_balance = Global.current_application_address.balance
global CurrentApplicationAddress
acct_params_get AcctBalance
assert // account funded
// smart_contracts/nft_marketplace/contract.py:182-186
// smart_contracts/nft_marketplace/contract.py:181-185
// itxn.AssetTransfer(
// xfer_asset=self.asset_id,
// asset_receiver=Global.creator_address,
// asset_close_to=Global.creator_address,
// ).submit()
itxn_begin
// smart_contracts/nft_marketplace/contract.py:183
// smart_contracts/nft_marketplace/contract.py:182
// xfer_asset=self.asset_id,
int 0
byte "asset_id"
app_global_get_ex
assert // check asset_id exists
// smart_contracts/nft_marketplace/contract.py:184
// smart_contracts/nft_marketplace/contract.py:183
// asset_receiver=Global.creator_address,
global CreatorAddress
// smart_contracts/nft_marketplace/contract.py:185
// smart_contracts/nft_marketplace/contract.py:184
// asset_close_to=Global.creator_address,
dup
itxn_field AssetCloseTo
itxn_field AssetReceiver
itxn_field XferAsset
// smart_contracts/nft_marketplace/contract.py:182
// smart_contracts/nft_marketplace/contract.py:181
// itxn.AssetTransfer(
int axfer
itxn_field TypeEnum
// smart_contracts/nft_marketplace/contract.py:182-186
// smart_contracts/nft_marketplace/contract.py:181-185
// itxn.AssetTransfer(
// xfer_asset=self.asset_id,
// asset_receiver=Global.creator_address,
// asset_close_to=Global.creator_address,
// ).submit()
itxn_submit
// smart_contracts/nft_marketplace/contract.py:188-191
// smart_contracts/nft_marketplace/contract.py:187-190
// itxn.Payment(
// receiver=Global.creator_address,
// close_remainder_to=Global.creator_address,
// ).submit()
itxn_begin
// smart_contracts/nft_marketplace/contract.py:189
// smart_contracts/nft_marketplace/contract.py:188
// receiver=Global.creator_address,
global CreatorAddress
// smart_contracts/nft_marketplace/contract.py:190
// smart_contracts/nft_marketplace/contract.py:189
// close_remainder_to=Global.creator_address,
dup
itxn_field CloseRemainderTo
itxn_field Receiver
// smart_contracts/nft_marketplace/contract.py:188
// smart_contracts/nft_marketplace/contract.py:187
// itxn.Payment(
int pay
itxn_field TypeEnum
// smart_contracts/nft_marketplace/contract.py:188-191
// smart_contracts/nft_marketplace/contract.py:187-190
// itxn.Payment(
// receiver=Global.creator_address,
// close_remainder_to=Global.creator_address,
// ).submit()
itxn_submit
// smart_contracts/nft_marketplace/contract.py:193
// smart_contracts/nft_marketplace/contract.py:192
// return contract_balance
retsub

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self) -> None:
self.bootstrapped = False

"""
문제 3
문제 2
bootstrap 메서드를 구현하세요.
bootstrap 메서드는 앱이 판매할 에셋(ASA)을 설정하고, 단가를 설정하고 에셋이 앱 계정이 옵트인 하는 메서드입니다.
Expand Down Expand Up @@ -105,7 +105,7 @@ def bootstrap(
).submit()

"""
문제 4
문제 3
buy 메서드를 구현하세요.
buy 메서드는 앱에서 판매하는 에셋(ASA)을 구매할때 구매자가 호출하는 메서드입니다.
Expand Down Expand Up @@ -136,7 +136,6 @@ def buy(
assert buyer_txn.sender == Txn.sender
assert buyer_txn.receiver == Global.current_application_address
assert buyer_txn.amount == self.unitary_price * quantity
assert Txn.sender != Global.creator_address

itxn.AssetTransfer(
xfer_asset=self.asset_id,
Expand All @@ -145,7 +144,7 @@ def buy(
).submit()

"""
문제 5 (쪼금 어려움 😝)
문제 4
withdraw_and_delete 메서드를 구현하세요.
withdraw_and_delete 메서드는 앱 계정에 있는 잔여 에셋(ASA)을 앱 계정으로 전송하고,
Expand Down
Loading

0 comments on commit e3df3c2

Please sign in to comment.