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

[Agoric-cli] Add Zoe contract example for concert/opera seats #543

Closed
katelynsills opened this issue Feb 12, 2020 · 7 comments · Fixed by #780
Closed

[Agoric-cli] Add Zoe contract example for concert/opera seats #543

katelynsills opened this issue Feb 12, 2020 · 7 comments · Fixed by #780
Assignees
Labels
agoric-cli package: agoric-cli Zoe package: Zoe

Comments

@katelynsills
Copy link
Contributor

katelynsills commented Feb 12, 2020

For Zoe Alpha, we need a basic non-fungible use case. We can start with the documentation that @DavidBruant wrote for event tickets. First, we will need to write up the example in ERTP tests (see precursor issue #545).

Because we only will have Zoe as a contract platform in Zoe Alpha (the generalized contract spawner isn't ready yet), we will need to write an example Zoe contract that is used solely for minting and can be deployed through the agoric-cli to the testnet. To summarize: digital assets are minted in the smart contract on Zoe, then escrowed with Zoe, and then sent to the user through the payout mechanism.

Autoswap happens to have an internal mint that we can copy for this. To send the newly minted assets to users, we will need to create an offer from the smart contact side that offers the assets. A user must also make an offer in order to get the digital assets as a payout from Zoe. Perhaps the contract requires payment in some form for minting.

If we can make this a general purpose minting contract, it could be written inside packages/zoe/src/contracts. If we can't easily do that, it should live inside packages/agoric-cli/template/contract.

@katelynsills katelynsills added agoric-cli package: agoric-cli Zoe package: Zoe labels Feb 12, 2020
@katelynsills
Copy link
Contributor Author

@DavidBruant does this sound like a task you could take on?

@DavidBruant
Copy link
Contributor

I'll work on #545 first, but i feel i can give it a try

@dtribble
Copy link
Member

Added Kate to assignees so it's tracked on the board in the scrum.

@DavidBruant
Copy link
Contributor

digital assets are minted in the smart contract on Zoe

This part surprised me a bit. In real life, i imagine the auditorium would first mint the tickets, then escrow them in a simple exchange/autoswap (should tests be added to make sure these contracts work also with non-fungible assets?)

But that's okay for now.

Here is a comment i added at the top of the contract file:

Roles in the arrangement:
  • Contract creator: describes the contract with:
    • number of seats, show, date/time of start
    • expected (ERTP) amount per ticket (we assume all tickets cost the same)
  • Smart Contract:
    • mints the tickets
    • provides the seats
  • Auditorium (unique contract seat, usually taken by the contract creator): the person hosting
    the Opera show, selling the tickets and getting the payment back
  • Ticket buyers (contract seat created on demand):
    • can see the available opera show seats
    • can consult the terms
    • can redeem the zoe invite with the proper payment to get the ticket back

Here is a comment i added to the contract i'm working on:

Test Scenario

The Opera de Bordeaux plays the contract creator and the auditorium
It creates the contract for a show ("Steven Universe, the Opera", Web, March 25th 2020 at 8pm, 3 tickets)
The Opera wants 22 moolas per ticket

Alice buys ticket #1

Bob tries to buy ticket 1 and fails. He buys ticket #2 and #3

Christine asks the contract for an invite and the contract answers that there are no tickets left to buy

The Opera is told about the show being sold out. It gets all the moolas from the sale

Unless there is a strong disagreement, i'm moving forward with this. I'll send a draft PR tomorrow with wherever i'll be at

@katelynsills
Copy link
Contributor Author

digital assets are minted in the smart contract on Zoe

This part surprised me a bit. In real life, i imagine the auditorium would first mint the tickets, then escrow them in a simple exchange/autoswap (should tests be added to make sure these contracts work also with non-fungible assets?)

Yeah, the surprise is correct. Every piece of code that runs on-chain must be either run by Zoe or the vat spawner. Since we don't have the vat spawner back up to full functionality yet, and don't have plans to have it for the hackathon (this was an executive decision), we can only use Zoe, but Zoe is not intended to be used in this way. So we're doing something that is very odd.

Also, yes, we should be adding tests to make sure the contracts work with non-fungible assets. They all should, but we currently have no tests for that. I'll add an issue.

Your current plan sounds like a good one to me. Let's keep going with that. Thanks!

@katelynsills
Copy link
Contributor Author

Issue for the non-fungible tests here: #771

@DavidBruant
Copy link
Contributor

oh, that makes sense for me now! Thanks for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agoric-cli package: agoric-cli Zoe package: Zoe
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants