|
| 1 | +#pragma version 10 |
| 2 | + |
| 3 | +smart_contracts.nft_marketplace.contract.NftMarketplace.approval_program: |
| 4 | + txn ApplicationID |
| 5 | + bnz main_entrypoint@2 |
| 6 | + callsub __init__ |
| 7 | + |
| 8 | +main_entrypoint@2: |
| 9 | + // smart_contracts/nft_marketplace/contract.py:20 |
| 10 | + // class NftMarketplace(arc4.ARC4Contract): |
| 11 | + txn NumAppArgs |
| 12 | + bz main_bare_routing@9 |
| 13 | + method "bootstrap(asset,uint64,pay)void" |
| 14 | + method "buy(pay,uint64)void" |
| 15 | + method "withdraw_and_delete()void" |
| 16 | + txna ApplicationArgs 0 |
| 17 | + match main_bootstrap_route@4 main_buy_route@5 main_withdraw_and_delete_route@6 |
| 18 | + err // reject transaction |
| 19 | + |
| 20 | +main_bootstrap_route@4: |
| 21 | + // smart_contracts/nft_marketplace/contract.py:96 |
| 22 | + // @arc4.abimethod |
| 23 | + txn OnCompletion |
| 24 | + ! |
| 25 | + assert // OnCompletion is NoOp |
| 26 | + txn ApplicationID |
| 27 | + assert // is not creating |
| 28 | + // smart_contracts/nft_marketplace/contract.py:20 |
| 29 | + // class NftMarketplace(arc4.ARC4Contract): |
| 30 | + txna ApplicationArgs 1 |
| 31 | + btoi |
| 32 | + txnas Assets |
| 33 | + txna ApplicationArgs 2 |
| 34 | + btoi |
| 35 | + txn GroupIndex |
| 36 | + int 1 |
| 37 | + - |
| 38 | + dup |
| 39 | + gtxns TypeEnum |
| 40 | + int pay |
| 41 | + == |
| 42 | + assert // transaction type is pay |
| 43 | + // smart_contracts/nft_marketplace/contract.py:96 |
| 44 | + // @arc4.abimethod |
| 45 | + callsub bootstrap |
| 46 | + int 1 |
| 47 | + return |
| 48 | + |
| 49 | +main_buy_route@5: |
| 50 | + // smart_contracts/nft_marketplace/contract.py:147 |
| 51 | + // @arc4.abimethod |
| 52 | + txn OnCompletion |
| 53 | + ! |
| 54 | + assert // OnCompletion is NoOp |
| 55 | + txn ApplicationID |
| 56 | + assert // is not creating |
| 57 | + // smart_contracts/nft_marketplace/contract.py:20 |
| 58 | + // class NftMarketplace(arc4.ARC4Contract): |
| 59 | + txn GroupIndex |
| 60 | + int 1 |
| 61 | + - |
| 62 | + dup |
| 63 | + gtxns TypeEnum |
| 64 | + int pay |
| 65 | + == |
| 66 | + assert // transaction type is pay |
| 67 | + txna ApplicationArgs 1 |
| 68 | + btoi |
| 69 | + // smart_contracts/nft_marketplace/contract.py:147 |
| 70 | + // @arc4.abimethod |
| 71 | + callsub buy |
| 72 | + int 1 |
| 73 | + return |
| 74 | + |
| 75 | +main_withdraw_and_delete_route@6: |
| 76 | + // smart_contracts/nft_marketplace/contract.py:210 |
| 77 | + // @arc4.abimethod(allow_actions=["DeleteApplication"]) |
| 78 | + txn OnCompletion |
| 79 | + int DeleteApplication |
| 80 | + == |
| 81 | + assert // OnCompletion is DeleteApplication |
| 82 | + txn ApplicationID |
| 83 | + assert // is not creating |
| 84 | + callsub withdraw_and_delete |
| 85 | + int 1 |
| 86 | + return |
| 87 | + |
| 88 | +main_bare_routing@9: |
| 89 | + // smart_contracts/nft_marketplace/contract.py:20 |
| 90 | + // class NftMarketplace(arc4.ARC4Contract): |
| 91 | + txn OnCompletion |
| 92 | + ! |
| 93 | + assert // reject transaction |
| 94 | + txn ApplicationID |
| 95 | + ! |
| 96 | + assert // is creating |
| 97 | + int 1 |
| 98 | + return |
| 99 | + |
| 100 | + |
| 101 | +// smart_contracts.nft_marketplace.contract.NftMarketplace.bootstrap(asset: uint64, unitary_price: uint64, mbr_pay: uint64) -> void: |
| 102 | +bootstrap: |
| 103 | + // smart_contracts/nft_marketplace/contract.py:96-99 |
| 104 | + // @arc4.abimethod |
| 105 | + // def bootstrap( |
| 106 | + // self, asset: Asset, unitary_price: UInt64, mbr_pay: gtxn.PaymentTransaction |
| 107 | + // ) -> None: |
| 108 | + proto 3 0 |
| 109 | + // smart_contracts/nft_marketplace/contract.py:100 |
| 110 | + // assert Txn.sender == Global.creator_address |
| 111 | + txn Sender |
| 112 | + global CreatorAddress |
| 113 | + == |
| 114 | + assert |
| 115 | + // smart_contracts/nft_marketplace/contract.py:101 |
| 116 | + // assert not self.bootstrapped |
| 117 | + int 0 |
| 118 | + byte "bootstrapped" |
| 119 | + app_global_get_ex |
| 120 | + assert // check bootstrapped exists |
| 121 | + ! |
| 122 | + assert |
| 123 | + // smart_contracts/nft_marketplace/contract.py:102 |
| 124 | + // assert mbr_pay.receiver == Global.current_application_address |
| 125 | + frame_dig -1 |
| 126 | + gtxns Receiver |
| 127 | + global CurrentApplicationAddress |
| 128 | + == |
| 129 | + assert |
| 130 | + // smart_contracts/nft_marketplace/contract.py:103 |
| 131 | + // assert mbr_pay.amount == Global.min_balance + Global.asset_opt_in_min_balance |
| 132 | + frame_dig -1 |
| 133 | + gtxns Amount |
| 134 | + global MinBalance |
| 135 | + global AssetOptInMinBalance |
| 136 | + + |
| 137 | + == |
| 138 | + assert |
| 139 | + // smart_contracts/nft_marketplace/contract.py:105 |
| 140 | + // self.asset_id = asset.id |
| 141 | + byte "asset_id" |
| 142 | + frame_dig -3 |
| 143 | + app_global_put |
| 144 | + // smart_contracts/nft_marketplace/contract.py:106 |
| 145 | + // self.unitary_price = unitary_price |
| 146 | + byte "unitary_price" |
| 147 | + frame_dig -2 |
| 148 | + app_global_put |
| 149 | + // smart_contracts/nft_marketplace/contract.py:107 |
| 150 | + // self.bootstrapped = True |
| 151 | + byte "bootstrapped" |
| 152 | + int 1 |
| 153 | + app_global_put |
| 154 | + // smart_contracts/nft_marketplace/contract.py:109-113 |
| 155 | + // itxn.AssetTransfer( |
| 156 | + // xfer_asset=asset, |
| 157 | + // asset_receiver=Global.current_application_address, |
| 158 | + // asset_amount=0, |
| 159 | + // ).submit() |
| 160 | + itxn_begin |
| 161 | + // smart_contracts/nft_marketplace/contract.py:111 |
| 162 | + // asset_receiver=Global.current_application_address, |
| 163 | + global CurrentApplicationAddress |
| 164 | + // smart_contracts/nft_marketplace/contract.py:112 |
| 165 | + // asset_amount=0, |
| 166 | + int 0 |
| 167 | + itxn_field AssetAmount |
| 168 | + itxn_field AssetReceiver |
| 169 | + frame_dig -3 |
| 170 | + itxn_field XferAsset |
| 171 | + // smart_contracts/nft_marketplace/contract.py:109 |
| 172 | + // itxn.AssetTransfer( |
| 173 | + int axfer |
| 174 | + itxn_field TypeEnum |
| 175 | + // smart_contracts/nft_marketplace/contract.py:109-113 |
| 176 | + // itxn.AssetTransfer( |
| 177 | + // xfer_asset=asset, |
| 178 | + // asset_receiver=Global.current_application_address, |
| 179 | + // asset_amount=0, |
| 180 | + // ).submit() |
| 181 | + itxn_submit |
| 182 | + retsub |
| 183 | + |
| 184 | + |
| 185 | +// smart_contracts.nft_marketplace.contract.NftMarketplace.buy(buyer_txn: uint64, quantity: uint64) -> void: |
| 186 | +buy: |
| 187 | + // smart_contracts/nft_marketplace/contract.py:147-152 |
| 188 | + // @arc4.abimethod |
| 189 | + // def buy( |
| 190 | + // self, |
| 191 | + // buyer_txn: gtxn.PaymentTransaction, |
| 192 | + // quantity: UInt64, |
| 193 | + // ) -> None: |
| 194 | + proto 2 0 |
| 195 | + // smart_contracts/nft_marketplace/contract.py:153 |
| 196 | + // assert self.bootstrapped == True |
| 197 | + int 0 |
| 198 | + byte "bootstrapped" |
| 199 | + app_global_get_ex |
| 200 | + assert // check bootstrapped exists |
| 201 | + int 1 |
| 202 | + == |
| 203 | + assert |
| 204 | + // smart_contracts/nft_marketplace/contract.py:154 |
| 205 | + // assert buyer_txn.sender == Txn.sender |
| 206 | + frame_dig -2 |
| 207 | + gtxns Sender |
| 208 | + txn Sender |
| 209 | + == |
| 210 | + assert |
| 211 | + // smart_contracts/nft_marketplace/contract.py:155 |
| 212 | + // assert buyer_txn.receiver == Global.current_application_address |
| 213 | + frame_dig -2 |
| 214 | + gtxns Receiver |
| 215 | + global CurrentApplicationAddress |
| 216 | + == |
| 217 | + assert |
| 218 | + // smart_contracts/nft_marketplace/contract.py:156 |
| 219 | + // assert buyer_txn.amount == self.unitary_price * quantity |
| 220 | + frame_dig -2 |
| 221 | + gtxns Amount |
| 222 | + int 0 |
| 223 | + byte "unitary_price" |
| 224 | + app_global_get_ex |
| 225 | + assert // check unitary_price exists |
| 226 | + frame_dig -1 |
| 227 | + * |
| 228 | + == |
| 229 | + assert |
| 230 | + // smart_contracts/nft_marketplace/contract.py:158-162 |
| 231 | + // itxn.AssetTransfer( |
| 232 | + // xfer_asset=self.asset_id, |
| 233 | + // asset_receiver=Txn.sender, |
| 234 | + // asset_amount=quantity, |
| 235 | + // ).submit() |
| 236 | + itxn_begin |
| 237 | + // smart_contracts/nft_marketplace/contract.py:159 |
| 238 | + // xfer_asset=self.asset_id, |
| 239 | + int 0 |
| 240 | + byte "asset_id" |
| 241 | + app_global_get_ex |
| 242 | + assert // check asset_id exists |
| 243 | + // smart_contracts/nft_marketplace/contract.py:160 |
| 244 | + // asset_receiver=Txn.sender, |
| 245 | + txn Sender |
| 246 | + frame_dig -1 |
| 247 | + itxn_field AssetAmount |
| 248 | + itxn_field AssetReceiver |
| 249 | + itxn_field XferAsset |
| 250 | + // smart_contracts/nft_marketplace/contract.py:158 |
| 251 | + // itxn.AssetTransfer( |
| 252 | + int axfer |
| 253 | + itxn_field TypeEnum |
| 254 | + // smart_contracts/nft_marketplace/contract.py:158-162 |
| 255 | + // itxn.AssetTransfer( |
| 256 | + // xfer_asset=self.asset_id, |
| 257 | + // asset_receiver=Txn.sender, |
| 258 | + // asset_amount=quantity, |
| 259 | + // ).submit() |
| 260 | + itxn_submit |
| 261 | + retsub |
| 262 | + |
| 263 | + |
| 264 | +// smart_contracts.nft_marketplace.contract.NftMarketplace.withdraw_and_delete() -> void: |
| 265 | +withdraw_and_delete: |
| 266 | + // smart_contracts/nft_marketplace/contract.py:210-211 |
| 267 | + // @arc4.abimethod(allow_actions=["DeleteApplication"]) |
| 268 | + // def withdraw_and_delete(self) -> None: |
| 269 | + proto 0 0 |
| 270 | + // smart_contracts/nft_marketplace/contract.py:212 |
| 271 | + // assert Txn.sender == Global.creator_address |
| 272 | + txn Sender |
| 273 | + global CreatorAddress |
| 274 | + == |
| 275 | + assert |
| 276 | + // smart_contracts/nft_marketplace/contract.py:214-218 |
| 277 | + // itxn.AssetTransfer( |
| 278 | + // xfer_asset=self.asset_id, |
| 279 | + // asset_receiver=Global.creator_address, |
| 280 | + // asset_close_to=Global.creator_address, |
| 281 | + // ).submit() |
| 282 | + itxn_begin |
| 283 | + // smart_contracts/nft_marketplace/contract.py:215 |
| 284 | + // xfer_asset=self.asset_id, |
| 285 | + int 0 |
| 286 | + byte "asset_id" |
| 287 | + app_global_get_ex |
| 288 | + assert // check asset_id exists |
| 289 | + // smart_contracts/nft_marketplace/contract.py:216 |
| 290 | + // asset_receiver=Global.creator_address, |
| 291 | + global CreatorAddress |
| 292 | + // smart_contracts/nft_marketplace/contract.py:217 |
| 293 | + // asset_close_to=Global.creator_address, |
| 294 | + dup |
| 295 | + itxn_field AssetCloseTo |
| 296 | + itxn_field AssetReceiver |
| 297 | + itxn_field XferAsset |
| 298 | + // smart_contracts/nft_marketplace/contract.py:214 |
| 299 | + // itxn.AssetTransfer( |
| 300 | + int axfer |
| 301 | + itxn_field TypeEnum |
| 302 | + // smart_contracts/nft_marketplace/contract.py:214-218 |
| 303 | + // itxn.AssetTransfer( |
| 304 | + // xfer_asset=self.asset_id, |
| 305 | + // asset_receiver=Global.creator_address, |
| 306 | + // asset_close_to=Global.creator_address, |
| 307 | + // ).submit() |
| 308 | + itxn_submit |
| 309 | + // smart_contracts/nft_marketplace/contract.py:220-223 |
| 310 | + // itxn.Payment( |
| 311 | + // receiver=Global.creator_address, |
| 312 | + // close_remainder_to=Global.creator_address, |
| 313 | + // ).submit() |
| 314 | + itxn_begin |
| 315 | + // smart_contracts/nft_marketplace/contract.py:221 |
| 316 | + // receiver=Global.creator_address, |
| 317 | + global CreatorAddress |
| 318 | + // smart_contracts/nft_marketplace/contract.py:222 |
| 319 | + // close_remainder_to=Global.creator_address, |
| 320 | + dup |
| 321 | + itxn_field CloseRemainderTo |
| 322 | + itxn_field Receiver |
| 323 | + // smart_contracts/nft_marketplace/contract.py:220 |
| 324 | + // itxn.Payment( |
| 325 | + int pay |
| 326 | + itxn_field TypeEnum |
| 327 | + // smart_contracts/nft_marketplace/contract.py:220-223 |
| 328 | + // itxn.Payment( |
| 329 | + // receiver=Global.creator_address, |
| 330 | + // close_remainder_to=Global.creator_address, |
| 331 | + // ).submit() |
| 332 | + itxn_submit |
| 333 | + retsub |
| 334 | + |
| 335 | + |
| 336 | +// smart_contracts.nft_marketplace.contract.NftMarketplace.__init__() -> void: |
| 337 | +__init__: |
| 338 | + // smart_contracts/nft_marketplace/contract.py:48 |
| 339 | + // def __init__(self) -> None: |
| 340 | + proto 0 0 |
| 341 | + // smart_contracts/nft_marketplace/contract.py:50 |
| 342 | + // self.asset_id = UInt64(0) |
| 343 | + byte "asset_id" |
| 344 | + int 0 |
| 345 | + app_global_put |
| 346 | + // smart_contracts/nft_marketplace/contract.py:51 |
| 347 | + // self.unitary_price = UInt64(0) |
| 348 | + byte "unitary_price" |
| 349 | + int 0 |
| 350 | + app_global_put |
| 351 | + // smart_contracts/nft_marketplace/contract.py:52 |
| 352 | + // self.bootstrapped = False |
| 353 | + byte "bootstrapped" |
| 354 | + int 0 |
| 355 | + app_global_put |
| 356 | + retsub |
0 commit comments