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

과제 제출 예시 #2

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,356 @@
#pragma version 10

smart_contracts.nft_marketplace.contract.NftMarketplace.approval_program:
txn ApplicationID
bnz main_entrypoint@2
callsub __init__

main_entrypoint@2:
// smart_contracts/nft_marketplace/contract.py:20
// class NftMarketplace(arc4.ARC4Contract):
txn NumAppArgs
bz main_bare_routing@9
method "bootstrap(asset,uint64,pay)void"
method "buy(pay,uint64)void"
method "withdraw_and_delete()void"
txna ApplicationArgs 0
match main_bootstrap_route@4 main_buy_route@5 main_withdraw_and_delete_route@6
err // reject transaction

main_bootstrap_route@4:
// smart_contracts/nft_marketplace/contract.py:96
// @arc4.abimethod
txn OnCompletion
!
assert // OnCompletion is NoOp
txn ApplicationID
assert // is not creating
// smart_contracts/nft_marketplace/contract.py:20
// class NftMarketplace(arc4.ARC4Contract):
txna ApplicationArgs 1
btoi
txnas Assets
txna ApplicationArgs 2
btoi
txn GroupIndex
int 1
-
dup
gtxns TypeEnum
int pay
==
assert // transaction type is pay
// smart_contracts/nft_marketplace/contract.py:96
// @arc4.abimethod
callsub bootstrap
int 1
return

main_buy_route@5:
// smart_contracts/nft_marketplace/contract.py:147
// @arc4.abimethod
txn OnCompletion
!
assert // OnCompletion is NoOp
txn ApplicationID
assert // is not creating
// smart_contracts/nft_marketplace/contract.py:20
// class NftMarketplace(arc4.ARC4Contract):
txn GroupIndex
int 1
-
dup
gtxns TypeEnum
int pay
==
assert // transaction type is pay
txna ApplicationArgs 1
btoi
// smart_contracts/nft_marketplace/contract.py:147
// @arc4.abimethod
callsub buy
int 1
return

main_withdraw_and_delete_route@6:
// smart_contracts/nft_marketplace/contract.py:210
// @arc4.abimethod(allow_actions=["DeleteApplication"])
txn OnCompletion
int DeleteApplication
==
assert // OnCompletion is DeleteApplication
txn ApplicationID
assert // is not creating
callsub withdraw_and_delete
int 1
return

main_bare_routing@9:
// smart_contracts/nft_marketplace/contract.py:20
// class NftMarketplace(arc4.ARC4Contract):
txn OnCompletion
!
assert // reject transaction
txn ApplicationID
!
assert // is creating
int 1
return


// smart_contracts.nft_marketplace.contract.NftMarketplace.bootstrap(asset: uint64, unitary_price: uint64, mbr_pay: uint64) -> void:
bootstrap:
// smart_contracts/nft_marketplace/contract.py:96-99
// @arc4.abimethod
// def bootstrap(
// self, asset: Asset, unitary_price: UInt64, mbr_pay: gtxn.PaymentTransaction
// ) -> None:
proto 3 0
// smart_contracts/nft_marketplace/contract.py:100
// assert Txn.sender == Global.creator_address
txn Sender
global CreatorAddress
==
assert
// smart_contracts/nft_marketplace/contract.py:101
// assert not self.bootstrapped
int 0
byte "bootstrapped"
app_global_get_ex
assert // check bootstrapped exists
!
assert
// smart_contracts/nft_marketplace/contract.py:102
// assert mbr_pay.receiver == Global.current_application_address
frame_dig -1
gtxns Receiver
global CurrentApplicationAddress
==
assert
// smart_contracts/nft_marketplace/contract.py:103
// assert mbr_pay.amount == Global.min_balance + Global.asset_opt_in_min_balance
frame_dig -1
gtxns Amount
global MinBalance
global AssetOptInMinBalance
+
==
assert
// smart_contracts/nft_marketplace/contract.py:105
// self.asset_id = asset.id
byte "asset_id"
frame_dig -3
app_global_put
// smart_contracts/nft_marketplace/contract.py:106
// self.unitary_price = unitary_price
byte "unitary_price"
frame_dig -2
app_global_put
// smart_contracts/nft_marketplace/contract.py:107
// self.bootstrapped = True
byte "bootstrapped"
int 1
app_global_put
// smart_contracts/nft_marketplace/contract.py:109-113
// itxn.AssetTransfer(
// xfer_asset=asset,
// asset_receiver=Global.current_application_address,
// asset_amount=0,
// ).submit()
itxn_begin
// smart_contracts/nft_marketplace/contract.py:111
// asset_receiver=Global.current_application_address,
global CurrentApplicationAddress
// smart_contracts/nft_marketplace/contract.py:112
// asset_amount=0,
int 0
itxn_field AssetAmount
itxn_field AssetReceiver
frame_dig -3
itxn_field XferAsset
// smart_contracts/nft_marketplace/contract.py:109
// itxn.AssetTransfer(
int axfer
itxn_field TypeEnum
// smart_contracts/nft_marketplace/contract.py:109-113
// itxn.AssetTransfer(
// xfer_asset=asset,
// asset_receiver=Global.current_application_address,
// asset_amount=0,
// ).submit()
itxn_submit
retsub


// smart_contracts.nft_marketplace.contract.NftMarketplace.buy(buyer_txn: uint64, quantity: uint64) -> void:
buy:
// smart_contracts/nft_marketplace/contract.py:147-152
// @arc4.abimethod
// def buy(
// self,
// buyer_txn: gtxn.PaymentTransaction,
// quantity: UInt64,
// ) -> None:
proto 2 0
// smart_contracts/nft_marketplace/contract.py:153
// assert self.bootstrapped == True
int 0
byte "bootstrapped"
app_global_get_ex
assert // check bootstrapped exists
int 1
==
assert
// smart_contracts/nft_marketplace/contract.py:154
// assert buyer_txn.sender == Txn.sender
frame_dig -2
gtxns Sender
txn Sender
==
assert
// smart_contracts/nft_marketplace/contract.py:155
// assert buyer_txn.receiver == Global.current_application_address
frame_dig -2
gtxns Receiver
global CurrentApplicationAddress
==
assert
// smart_contracts/nft_marketplace/contract.py:156
// assert buyer_txn.amount == self.unitary_price * quantity
frame_dig -2
gtxns Amount
int 0
byte "unitary_price"
app_global_get_ex
assert // check unitary_price exists
frame_dig -1
*
==
assert
// smart_contracts/nft_marketplace/contract.py:158-162
// itxn.AssetTransfer(
// xfer_asset=self.asset_id,
// asset_receiver=Txn.sender,
// asset_amount=quantity,
// ).submit()
itxn_begin
// smart_contracts/nft_marketplace/contract.py:159
// 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:160
// asset_receiver=Txn.sender,
txn Sender
frame_dig -1
itxn_field AssetAmount
itxn_field AssetReceiver
itxn_field XferAsset
// smart_contracts/nft_marketplace/contract.py:158
// itxn.AssetTransfer(
int axfer
itxn_field TypeEnum
// smart_contracts/nft_marketplace/contract.py:158-162
// itxn.AssetTransfer(
// xfer_asset=self.asset_id,
// asset_receiver=Txn.sender,
// asset_amount=quantity,
// ).submit()
itxn_submit
retsub


// smart_contracts.nft_marketplace.contract.NftMarketplace.withdraw_and_delete() -> void:
withdraw_and_delete:
// smart_contracts/nft_marketplace/contract.py:210-211
// @arc4.abimethod(allow_actions=["DeleteApplication"])
// def withdraw_and_delete(self) -> None:
proto 0 0
// smart_contracts/nft_marketplace/contract.py:212
// assert Txn.sender == Global.creator_address
txn Sender
global CreatorAddress
==
assert
// smart_contracts/nft_marketplace/contract.py:214-218
// 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:215
// 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:216
// asset_receiver=Global.creator_address,
global CreatorAddress
// smart_contracts/nft_marketplace/contract.py:217
// asset_close_to=Global.creator_address,
dup
itxn_field AssetCloseTo
itxn_field AssetReceiver
itxn_field XferAsset
// smart_contracts/nft_marketplace/contract.py:214
// itxn.AssetTransfer(
int axfer
itxn_field TypeEnum
// smart_contracts/nft_marketplace/contract.py:214-218
// 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:220-223
// itxn.Payment(
// receiver=Global.creator_address,
// close_remainder_to=Global.creator_address,
// ).submit()
itxn_begin
// smart_contracts/nft_marketplace/contract.py:221
// receiver=Global.creator_address,
global CreatorAddress
// smart_contracts/nft_marketplace/contract.py:222
// close_remainder_to=Global.creator_address,
dup
itxn_field CloseRemainderTo
itxn_field Receiver
// smart_contracts/nft_marketplace/contract.py:220
// itxn.Payment(
int pay
itxn_field TypeEnum
// smart_contracts/nft_marketplace/contract.py:220-223
// itxn.Payment(
// receiver=Global.creator_address,
// close_remainder_to=Global.creator_address,
// ).submit()
itxn_submit
retsub


// smart_contracts.nft_marketplace.contract.NftMarketplace.__init__() -> void:
__init__:
// smart_contracts/nft_marketplace/contract.py:48
// def __init__(self) -> None:
proto 0 0
// smart_contracts/nft_marketplace/contract.py:50
// self.asset_id = UInt64(0)
byte "asset_id"
int 0
app_global_put
// smart_contracts/nft_marketplace/contract.py:51
// self.unitary_price = UInt64(0)
byte "unitary_price"
int 0
app_global_put
// smart_contracts/nft_marketplace/contract.py:52
// self.bootstrapped = False
byte "bootstrapped"
int 0
app_global_put
retsub

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma version 10

smart_contracts.nft_marketplace.contract.NftMarketplace.clear_state_program:
// smart_contracts/nft_marketplace/contract.py:20
// class NftMarketplace(arc4.ARC4Contract):
int 1
return

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
#pragma version 10

smart_contracts.nft_marketplace_list.contract.NftMarketplaceList.approval_program:
txn ApplicationID
bnz main_entrypoint@2
callsub __init__

main_entrypoint@2:
// smart_contracts/nft_marketplace_list/contract.py:9
// class NftMarketplaceList(ARC4Contract):
txn NumAppArgs
bz main_bare_routing@9
method "add_marketplace_to_list(uint64)uint64[]"
method "remove_marketplace_from_list(uint64)uint64[]"
method "read_marketplace_list()uint64[]"
txna ApplicationArgs 0
match main_add_marketplace_to_list_route@4 main_remove_marketplace_from_list_route@5 main_read_marketplace_list_route@6
err // reject transaction

main_add_marketplace_to_list_route@4:
// smart_contracts/nft_marketplace_list/contract.py:14
// @arc4.abimethod()
txn OnCompletion
!
assert // OnCompletion is NoOp
txn ApplicationID
assert // is not creating
// smart_contracts/nft_marketplace_list/contract.py:9
// class NftMarketplaceList(ARC4Contract):
txna ApplicationArgs 1
btoi
// smart_contracts/nft_marketplace_list/contract.py:14
// @arc4.abimethod()
callsub add_marketplace_to_list
byte 0x151f7c75
swap
concat
log
int 1
return

main_remove_marketplace_from_list_route@5:
// smart_contracts/nft_marketplace_list/contract.py:19
// @arc4.abimethod()
txn OnCompletion
!
assert // OnCompletion is NoOp
txn ApplicationID
assert // is not creating
// smart_contracts/nft_marketplace_list/contract.py:9
// class NftMarketplaceList(ARC4Contract):
txna ApplicationArgs 1
btoi
// smart_contracts/nft_marketplace_list/contract.py:19
// @arc4.abimethod()
callsub remove_marketplace_from_list
byte 0x151f7c75
swap
concat
log
int 1
return

main_read_marketplace_list_route@6:
// smart_contracts/nft_marketplace_list/contract.py:32
// @arc4.abimethod(readonly=True)
txn OnCompletion
!
assert // OnCompletion is NoOp
txn ApplicationID
assert // is not creating
callsub read_marketplace_list
byte 0x151f7c75
swap
concat
log
int 1
return

main_bare_routing@9:
// smart_contracts/nft_marketplace_list/contract.py:9
// class NftMarketplaceList(ARC4Contract):
txn OnCompletion
!
assert // reject transaction
txn ApplicationID
!
assert // is creating
int 1
return


// smart_contracts.nft_marketplace_list.contract.NftMarketplaceList.add_marketplace_to_list(app_id: uint64) -> bytes:
add_marketplace_to_list:
// smart_contracts/nft_marketplace_list/contract.py:14-15
// @arc4.abimethod()
// def add_marketplace_to_list(self, app_id: UInt64) -> app_id_list:
proto 1 1
// smart_contracts/nft_marketplace_list/contract.py:16
// self.marketplace_list.append(arc4.UInt64(app_id))
int 0
byte "marketplace_list"
app_global_get_ex
assert // check marketplace_list exists
extract 2 0
frame_dig -1
itob
concat
dup
len
int 8
/
itob
extract 6 0
swap
concat
byte "marketplace_list"
swap
app_global_put
// smart_contracts/nft_marketplace_list/contract.py:17
// return self.marketplace_list
int 0
byte "marketplace_list"
app_global_get_ex
assert // check marketplace_list exists
retsub


// smart_contracts.nft_marketplace_list.contract.NftMarketplaceList.remove_marketplace_from_list(app_id: uint64) -> bytes:
remove_marketplace_from_list:
// smart_contracts/nft_marketplace_list/contract.py:19-20
// @arc4.abimethod()
// def remove_marketplace_from_list(self, app_id: UInt64) -> app_id_list:
proto 1 1
int 0
dup
// smart_contracts/nft_marketplace_list/contract.py:21
// new_list = app_id_list()
byte 0x0000
// smart_contracts/nft_marketplace_list/contract.py:22
// for i in urange(self.marketplace_list.length):
int 0
byte "marketplace_list"
app_global_get_ex
assert // check marketplace_list exists
int 0
extract_uint16
int 0

remove_marketplace_from_list_for_header@1:
// smart_contracts/nft_marketplace_list/contract.py:22
// for i in urange(self.marketplace_list.length):
frame_dig 4
frame_dig 3
<
bz remove_marketplace_from_list_after_for@7
// smart_contracts/nft_marketplace_list/contract.py:23
// current_app_id = self.marketplace_list[i]
int 0
byte "marketplace_list"
app_global_get_ex
assert // check marketplace_list exists
dup
int 0
extract_uint16
frame_dig 4
dup
uncover 2
<
assert // Index access is out of bounds
swap
extract 2 0
swap
int 8
*
int 8
extract3
dup
frame_bury 0
// smart_contracts/nft_marketplace_list/contract.py:25
// if current_app_id != app_id:
frame_dig -1
itob
b!=
frame_dig 2
frame_bury 1
bz remove_marketplace_from_list_after_if_else@4
// smart_contracts/nft_marketplace_list/contract.py:26
// new_list.append(current_app_id)
frame_dig 2
extract 2 0
frame_dig 0
concat
dup
len
int 8
/
itob
extract 6 0
swap
concat
frame_bury 1

remove_marketplace_from_list_after_if_else@4:
frame_dig 1
frame_bury 2
// smart_contracts/nft_marketplace_list/contract.py:22
// for i in urange(self.marketplace_list.length):
frame_dig 4
int 1
+
frame_bury 4
b remove_marketplace_from_list_for_header@1

remove_marketplace_from_list_after_for@7:
// smart_contracts/nft_marketplace_list/contract.py:28
// self.marketplace_list = new_list.copy()
byte "marketplace_list"
frame_dig 2
app_global_put
// smart_contracts/nft_marketplace_list/contract.py:30
// return self.marketplace_list
int 0
byte "marketplace_list"
app_global_get_ex
assert // check marketplace_list exists
frame_bury 0
retsub


// smart_contracts.nft_marketplace_list.contract.NftMarketplaceList.read_marketplace_list() -> bytes:
read_marketplace_list:
// smart_contracts/nft_marketplace_list/contract.py:32-33
// @arc4.abimethod(readonly=True)
// def read_marketplace_list(self) -> app_id_list:
proto 0 1
// smart_contracts/nft_marketplace_list/contract.py:34
// return self.marketplace_list
int 0
byte "marketplace_list"
app_global_get_ex
assert // check marketplace_list exists
retsub


// smart_contracts.nft_marketplace_list.contract.NftMarketplaceList.__init__() -> void:
__init__:
// smart_contracts/nft_marketplace_list/contract.py:11
// def __init__(self) -> None:
proto 0 0
// smart_contracts/nft_marketplace_list/contract.py:12
// self.marketplace_list = app_id_list()
byte "marketplace_list"
byte 0x0000
app_global_put
retsub
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"hints": {
"add_marketplace_to_list(uint64)uint64[]": {
"call_config": {
"no_op": "CALL"
}
},
"remove_marketplace_from_list(uint64)uint64[]": {
"call_config": {
"no_op": "CALL"
}
},
"read_marketplace_list()uint64[]": {
"read_only": true,
"call_config": {
"no_op": "CALL"
}
}
},
"source": {
"approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlX2xpc3QuY29udHJhY3QuTmZ0TWFya2V0cGxhY2VMaXN0LmFwcHJvdmFsX3Byb2dyYW06CiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgYm56IG1haW5fZW50cnlwb2ludEAyCiAgICBjYWxsc3ViIF9faW5pdF9fCgptYWluX2VudHJ5cG9pbnRAMjoKICAgIC8vIHNtYXJ0X2NvbnRyYWN0cy9uZnRfbWFya2V0cGxhY2VfbGlzdC9jb250cmFjdC5weTo5CiAgICAvLyBjbGFzcyBOZnRNYXJrZXRwbGFjZUxpc3QoQVJDNENvbnRyYWN0KToKICAgIHR4biBOdW1BcHBBcmdzCiAgICBieiBtYWluX2JhcmVfcm91dGluZ0A5CiAgICBtZXRob2QgImFkZF9tYXJrZXRwbGFjZV90b19saXN0KHVpbnQ2NCl1aW50NjRbXSIKICAgIG1ldGhvZCAicmVt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2VMaXN0KEFSQzRDb250cmFjdCk6CiAgICBpbnQgMQogICAgcmV0dXJuCg=="
},
"state": {
"global": {
"num_byte_slices": 1,
"num_uints": 0
},
"local": {
"num_byte_slices": 0,
"num_uints": 0
}
},
"schema": {
"global": {
"declared": {
"marketplace_list": {
"type": "bytes",
"key": "marketplace_list"
}
},
"reserved": {}
},
"local": {
"declared": {},
"reserved": {}
}
},
"contract": {
"name": "NftMarketplaceList",
"methods": [
{
"name": "add_marketplace_to_list",
"args": [
{
"type": "uint64",
"name": "app_id"
}
],
"returns": {
"type": "uint64[]"
}
},
{
"name": "remove_marketplace_from_list",
"args": [
{
"type": "uint64",
"name": "app_id"
}
],
"returns": {
"type": "uint64[]"
}
},
{
"name": "read_marketplace_list",
"args": [],
"returns": {
"type": "uint64[]"
}
}
],
"networks": {}
},
"bare_call_config": {
"no_op": "CREATE"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma version 10

smart_contracts.nft_marketplace_list.contract.NftMarketplaceList.clear_state_program:
// smart_contracts/nft_marketplace_list/contract.py:9
// class NftMarketplaceList(ARC4Contract):
int 1
return

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -47,9 +47,9 @@ class NftMarketplace(arc4.ARC4Contract):

def __init__(self) -> None:
"문제 1 시작"
self.asset_id = "여기에 코드 작성"
self.unitary_price = "여기에 코드 작성"
self.bootstrapped = "여기에 코드 작성"
self.asset_id = UInt64(0)
self.unitary_price = UInt64(0)
self.bootstrapped = False
"문제 1 끝"

"""
@@ -97,7 +97,20 @@ def __init__(self) -> None:
def bootstrap(
self, asset: Asset, unitary_price: UInt64, mbr_pay: gtxn.PaymentTransaction
) -> None:
"여기에 코드 작성"
assert Txn.sender == Global.creator_address
assert not self.bootstrapped
assert mbr_pay.receiver == Global.current_application_address
assert mbr_pay.amount == Global.min_balance + Global.asset_opt_in_min_balance

self.asset_id = asset.id
self.unitary_price = unitary_price
self.bootstrapped = True

itxn.AssetTransfer(
xfer_asset=asset,
asset_receiver=Global.current_application_address,
asset_amount=0,
).submit()

"문제 2 끝"

@@ -137,7 +150,16 @@ def buy(
buyer_txn: gtxn.PaymentTransaction,
quantity: UInt64,
) -> None:
"여기에 코드 작성"
assert self.bootstrapped == True
assert buyer_txn.sender == Txn.sender
assert buyer_txn.receiver == Global.current_application_address
assert buyer_txn.amount == self.unitary_price * quantity

itxn.AssetTransfer(
xfer_asset=self.asset_id,
asset_receiver=Txn.sender,
asset_amount=quantity,
).submit()

"문제 3 끝"

@@ -187,6 +209,17 @@ def buy(

@arc4.abimethod(allow_actions=["DeleteApplication"])
def withdraw_and_delete(self) -> None:
"여기에 코드 작성"
assert Txn.sender == Global.creator_address

itxn.AssetTransfer(
xfer_asset=self.asset_id,
asset_receiver=Global.creator_address,
asset_close_to=Global.creator_address,
).submit()

itxn.Payment(
receiver=Global.creator_address,
close_remainder_to=Global.creator_address,
).submit()

"문제 4 끝"

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions projects/orakle-nft-marketplace-app-frontend/src/methods.ts
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ export function createAndListNft(
힌트: https://github.com/algorandfoundation/algokit-client-generator-ts/blob/main/docs/usage.md#create-calls
*/
// 문제 6 시작
const createResult = '여기에 코드 작성'
const createResult = await nftmClient.create.bare()
// 문제 6 끝

/*
@@ -78,10 +78,14 @@ export function createAndListNft(
sender,
receiver: createResult.appAddress,
amount: algokit.algos(0.1 + 0.1),
extraFee: '여기에 코드 작성',
extraFee: algokit.transactionFees(1),
})

;('여기에 코드 작성')
await nftmClient.bootstrap({
asset: assetBeingSold,
unitaryPrice,
mbrPay: mbrTxn,
})
// 문제 7 끝

const sendAssetToSell = {
@@ -161,7 +165,7 @@ export function buyNft(
assetId,
})
// 문제 8 시작
;('여기에 코드 작성')
await nftmClient.compose().addTransaction(assetOptInTxn).buy({ buyerTxn: buyerTxn, quantity }).execute()
// 문제 8 끝

console.log(`${sender}가 에셋에 옵트인하고 구매했어요!`)
@@ -209,7 +213,7 @@ export function deleteAppAndWithdraw(nftmClient: NftMarketplaceClient, listClien
*/

// 문제 9 시작
;('여기에 코드 작성')
await nftmClient.delete.withdrawAndDelete({}, { sendParams: { fee: algokit.algos(0.003) } })
// 문제 9 끝

await listClient.removeMarketplaceFromList({ appId: BigInt(appId) })
Original file line number Diff line number Diff line change
@@ -43,7 +43,14 @@ export function getCurrentNftmClient(
*/

// 문제 5 시작
const nftmClient = '여기에 코드 작성'
const nftmClient = new NftMarketplaceClient(
{
resolveBy: 'id',
id: currentAppId,
sender: { addr: activeAddress, signer },
},
algorandClient.client.algod,
)
// 문제 5 끝

return nftmClient
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const marketplaceListAppId = 1018 //테스트 중 에러가 발생하면 마켓플레이스 리스트 스마트계약을 재배포하고 새로운 app id로 교체해주세요.
export const marketplaceListAppId = 1238 //테스트 중 에러가 발생하면 마켓플레이스 리스트 스마트계약을 재배포하고 새로운 app id로 교체해주세요.

Unchanged files with check annotations Beta

const assetDetail = await algorandClient.client.algod.getAssetByID(Number(assetId)).do()
appDetails.assetName = assetDetail['params']['name']
const inputString = assetDetail['params']['url'] //returns -> "url": "ipfs://QmSiHBwQgK7Nnzas4Chc9Jg9EmJYjwAH3P4r6WeTAWme3w/#arc3",
console.log('inputString', inputString)

Check warning on line 50 in projects/orakle-nft-marketplace-app-frontend/src/utils/getAppList.ts

GitHub Actions / Run orakle-nft-marketplace-app-frontend validation / validate

Unexpected console statement
const slicedURL = inputString.split('ipfs://')[1]
let response
try {
response = await axios.get(`https://ipfs.algonode.xyz/ipfs/${slicedURL}`)
} catch (e) {
console.log('error', e)

Check warning on line 56 in projects/orakle-nft-marketplace-app-frontend/src/utils/getAppList.ts

GitHub Actions / Run orakle-nft-marketplace-app-frontend validation / validate

Unexpected console statement
continue
}
const responseImage = response.data.image