Skip to content

Commit 9e844ac

Browse files
marketplace snippets and improvements
1 parent 3a27ad5 commit 9e844ac

7 files changed

Lines changed: 281 additions & 160 deletions

File tree

cartesi-rollups_versioned_docs/version-2.0/tutorials/marketplace.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ Since our app uses the test ERC-721 and ERC-20 contracts automatically deployed
337337
- Mint token ID 1:
338338
339339
```bash
340-
cast send 0xBa46623aD94AB45850c4ecbA9555D26328917c3B \
340+
cast send 0x1c5AB37576Af4e6BEeCB66Fa6a9FdBc608F44B78 \
341341
"safeMint(address, uint256, string)" \
342342
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1 "" \
343343
--rpc-url http://127.0.0.1:6751/anvil \
@@ -351,9 +351,9 @@ This command calls the `safeMint` function in the `testNFT` contract deployed by
351351
Before an NFT can be deposited into the application, the portal contract must have permission to transfer it on behalf of the owner. Use the following command to grant that approval:
352352
353353
```bash
354-
cast send 0xBa46623aD94AB45850c4ecbA9555D26328917c3B \
354+
cast send 0x1c5AB37576Af4e6BEeCB66Fa6a9FdBc608F44B78 \
355355
"setApprovalForAll(address,bool)" \
356-
0xc700d52F5290e978e9CAe7D1E092935263b60051 true \
356+
0x9E8851dadb2b77103928518846c4678d48b5e371 true \
357357
--rpc-url http://127.0.0.1:6751/anvil \
358358
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
359359
```
@@ -408,7 +408,7 @@ With the NFT successfully listed for sale, it's time to attempt to purchase this
408408
- Transfer required tokens to purchase address.
409409

410410
```bash
411-
cast send 0xFBdB734EF6a23aD76863CbA6f10d0C5CBBD8342C \
411+
cast send 0x5138f529B77B4e0a7c84B77E79c4335D31938fed \
412412
"transfer(address,uint256)" 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 100000000000000000000 \
413413
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
414414
--rpc-url http://127.0.0.1:6751/anvil
@@ -436,13 +436,16 @@ Sending finish
436436

437437
### 5. Purchase Token with ID 1 [advance request]
438438

439-
Now that the buyer has deposited funds, we can proceed to purchase the NFT. To do this we make an advance request to the application using the Cartesi CLI by running the command:
439+
Now that the buyer has deposited funds, we can proceed to purchase the NFT. Use the following Cartesi CLI flow:
440440

441441
```bash
442-
cartesi send "{"method": "purchase_token", "token_id": 1}" --from 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
442+
cartesi send --from 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
443+
✔ Input String encoding
444+
✔ Input (as string) {"method": "purchase_token", "token_id": 1}
445+
✔ Input sent: 0x61dad3fb284470ab9e049fd45197062704376c797bdf020a5550f66d0dcec884
443446
```
444447

445-
This command notifies the marketplace that the address `0x7099797....0d17dc79C8` which initially deposited 100 tokens, would want to purchase token ID 1, The marketplace proceeds to run necessary checks like verifying that the token is for sale, and that the buyer has sufficient tokens to make the purchase, after which it executes the purchase and finally emits a voucher that transfers the tokens to the buyer's address. On a successful purchase, you should get logs similar to the below.
448+
This sends a purchase request for token ID `1` from the buyer address. The marketplace validates the request (token listed and sufficient balance), executes the purchase, and emits the voucher to transfer the NFT to the buyer.
446449

447450
```bash
448451
[INFO rollup_http_server::http_service] received new request of type ADVANCE

cartesi-rollups_versioned_docs/version-2.0/tutorials/snippets/calculator-go.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"log"
88
"os"
9-
109
"dapp/rollups"
1110
"github.com/Knetic/govaluate"
1211
)

0 commit comments

Comments
 (0)