Skip to content

Commit

Permalink
Merge pull request Agoric#24 from Agoric/gallery-demo-md
Browse files Browse the repository at this point in the history
rename gallery demo markdown and put in a number of commands
  • Loading branch information
michaelfig authored Jun 16, 2019
2 parents 2698360 + d94ff1b commit 9534bd1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 118 deletions.
118 changes: 0 additions & 118 deletions README-ag-solo-gallery-demo.md

This file was deleted.

50 changes: 50 additions & 0 deletions README-gallery-demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## Gallery Pixel Demo

In this Gallery Demo, the goal is to be able to create designs in a
pixel canvas. You start with access to the gallery and a handful of
methods that allow you to obtain pixels, color them, and buy or sell
pixels.

To access the gallery, type `home.gallery` in the REPL. `home.gallery` is a
Presence. In the SwingSet environment, Presences are remote references to objects on
other vats. To invoke them, use the `E` wrapper. For example, the
first thing you might want to do is tap the gallery faucet to get a
pixel for free:

```js
E(home.gallery).tapFaucet()
```

This returns a presence for the pixel that you receive from the
faucet and saves it under `history[0]`.

To color the pixel, we need to split the pixel into "transfer" and
"use" rights. The right to use the pixel means that you can color it,
and we'll be using it to color.

The following commands show a pixel being obtained from the faucet,
being transformed into transfer and use rights, coloring the pixel by
using the 'use' right, and selling a pixel to the gallery through a
escrow smart contract.

```
E(home.gallery).tapFaucet()
E(home.gallery).transformToTransferAndUse(history[0])
history[1].useRightPayment
E(home.gallery).changeColor(history[2], '#FF69B4')
E(home.gallery).tapFaucet()
E(history[4]).getBalance()
E(home.gallery).pricePixelAmount(history[5])
E(home.gallery).sellToGallery(history[5])
history[7].inviteP
history[7].host
E(history[9]).redeem(history[8])
E(history[10]).offer(history[4])
E(home.gallery).getIssuers()
history[12].pixelIssuer
history[12].dustIssuer
E(history[13]).makeEmptyPurse()
E(history[14]).makeEmptyPurse()
E(home.gallery).collectFromGallery(history[10], history[16],
history[15], 'my escrow')
```

0 comments on commit 9534bd1

Please sign in to comment.