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

Make the auction example end-to-end #6477

Merged
merged 18 commits into from
Sep 25, 2024
Merged

Make the auction example end-to-end #6477

merged 18 commits into from
Sep 25, 2024

Conversation

zliu41
Copy link
Member

@zliu41 zliu41 commented Sep 12, 2024

This PR expands the auction example to make it end-to-end, using mesh for off-chain code. Also removes some outdated or less relevant content.

For reviewers: it is recommend to review it by building the site locally: cd to doc/docusaurus, run nix develop, then run yarn install followed by yarn start.

If you prefer reviewing it on GH, you may want to review the files in this order:
auction

But note that code embedding won't work.

@rober-m @jinglescode feedback welcome

@zliu41 zliu41 added the No Changelog Required Add this to skip the Changelog Check label Sep 12, 2024
@zliu41 zliu41 requested review from brunjlar and a team September 12, 2024 21:05
@jmchapman
Copy link
Contributor

Cool!

@jinglescode
Copy link
Contributor

Very nice work @zliu41. Certainly wanted to add auction into smart contract lib for live demos useful for people to quickly connect wallet and try it out the contracts and transactions. I will read the markdown files and see if anything to add.

@rober-m
Copy link

rober-m commented Sep 13, 2024

@zliu41 I see a lot of PlutusTx and Plutus-as-platform references. Should I ignore that for this PR? Is the renaming of the docs and/or modules on the roadmap?

@zliu41
Copy link
Member Author

zliu41 commented Sep 13, 2024

I see a lot of PlutusTx and Plutus-as-platform references.

@rober-m

  • PlutusTx - I'll rename all occurrences in one go later in a separate PR
  • This PR doesn't mention Plutus-as-platform; I'll clean up any existing references later

@rober-m
Copy link

rober-m commented Sep 13, 2024

I haven't reviewed the whole thing yet, but I found a few issues we might want to make a decision about:

  • Currently, the MeshJS instructions won't work because the scripts can't download the packages. To solve it, we could:
    • Ask the student to create a folder with a package.json file or
    • change the imports to use URLs and use Deno instead of Node. (I wouldn't use Deno in a production app, but here, it would be fine)
  • The "Minting the Token to be auctioned" section asks the student to use blueprints (GenMintingPolicyBlueprint.hs), but that's not in the repo. Should we change the instructions or the repo?

zliu41 and others added 5 commits September 15, 2024 13:05
Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
Copy link
Member Author

@zliu41 zliu41 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ask the student to create a folder with a package.json file

Added the steps to create package.json in generating-keys.md.

The "Minting the Token to be auctioned" section asks the student to use blueprints (GenMintingPolicyBlueprint.hs), but that's not in the repo.

It will work once IntersectMBO/plutus-tx-template#20 is merged.

zeme-wana added a commit to IntersectMBO/plutus-tx-template that referenced this pull request Sep 16, 2024
Added `AuctionMintingPolicy.hs`, `GenAuctionValidatorBlueprint.hs` and
`app/GenMintingPolicyBlueprint.hs`, to make it compatible with
IntersectMBO/plutus#6477.

---------

Co-authored-by: zeme <lorenzo.calegari@iohk.io>
zliu41 and others added 7 commits September 16, 2024 16:21
Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
…bids.md

Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
@zeme-wana
Copy link
Contributor

zeme-wana commented Sep 17, 2024

Rebase off master to fix the failing PlutusTx Template check

@Unisay
Copy link
Contributor

Unisay commented Sep 17, 2024

JFYI: I am in the process of reviewing this PR...

…ng-keys.md

Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
Comment on lines +24 to +25
node send-lovelace.mjs bidder1
node send-lovelace.mjs bidder2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
node send-lovelace.mjs bidder1
node send-lovelace.mjs bidder2
pushd off-chain
node send-lovelace.mjs bidder1
node send-lovelace.mjs bidder2
popd

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previous commands assume that current dir is one level above the off-chain dir, but this command fails when executed not from the off-chain dir.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previous commands assume that current dir is one level above the off-chain dir

Are you referring to "To do so, create a file named off-chain/send-lovelace.mjs"? I can change it to "To do so, create a file named send-lovelace.mjs in off-chain". The previous task was to generate keys, and there's no need to leave the off-chain dir.


## On-chain Minting Policy Script

The full minting policy code can be found at [AuctionMintingPolicy.hs](https://github.com/IntersectMBO/plutus-tx-template/blob/main/src/AuctionMintingPolicy.hs).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that minting policy uses Plutus V2. Do we have a task to update it to the Plutus V3?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think V2 is fine for this example, since there's no advantage (in fact there's disadvantage) to use Plutus V3. But if anyone wants to update the example to V3, you are welcome to.

Next, we need to compile the minting policy script and create its blueprint.
To do so, we first need to supply a public key hash, which the minting policy will use for checking condition 1 above.
Assuming the seller is the one minting the token, this should be the seller's public key hash.
Open `GenMintingPolicyBlueprint.hs` in the `on-chain` directory, and replace `error "Replace with seller pkh"` with the content of `off-chain/seller.pkh`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to put auction validator script and minting policy script in two different blueprint files?
I can see how two different plutus scripts (validator, policy) together constitute a one logical "contract".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To generate blueprint for the auction validator, we need to know the hash of the minting validator, and currently the best way to get the hash is from the blueprint.

@@ -9,6 +9,7 @@ We can get funds from Cardano's [testnet faucet](https://docs.cardano.org/cardan

To request funds, enter the seller's address into the address field and click "request funds."
This will deposit 10,000 (test) ADA into the seller's wallet.
Make sure you select the correct network (Preview).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@zliu41 zliu41 merged commit 2694830 into master Sep 25, 2024
4 of 7 checks passed
@zliu41 zliu41 deleted the zliu41/auction branch September 25, 2024 18:21
ramsay-t pushed a commit that referenced this pull request Sep 26, 2024
ramsay-t added a commit that referenced this pull request Sep 26, 2024
… be more complex? (#6513)

* This seems 'too easy' but to certify things I don't think it needs to be more complex?

* Er, I think this was the wrong way round

* Add version select to haddock index page (#6499)

* Remove plutus-ghc-stub (#6514)

* Remove the Plutus Platform page (#6506)

* Make the auction example end-to-end (#6477)

* Mark `&&` and `||` OPAQUE (#6510)

* Translation relation and decision procedure for the Float-Delay (#6482)

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP - Most of the nFD->FD proof is done but I am now wondering if the application rules need the force in them...

* Some progress on the FD->pureFD proof... Not completely sure it is going in a good direction...

* Made the parameters to istranslation implicit, since they are encoded in the relation anyway

* WIP

* WIP

* WIP - with crazy variable binding issues

* Add 'forall DecEq' to 'Relation'

* Roman's additions.

* Workign Float-Delay translation relation and decision procedure.

* Missed a definition

* Now uses Purity, althought that is 'stub code' at the moment.

* Now with added Purity...

* Remove 'Terminating' from 'translation?'

---------

Co-authored-by: effectfully <effectfully@gmail.com>

* WIP

* Now with fake purity...

* Some WIP from the other branch that is needed here.

* Tidy some Agda...

* Agda...

---------

Co-authored-by: zeme-wana <15709674+zeme-wana@users.noreply.github.com>
Co-authored-by: Ziyang Liu <unsafeFixIO@gmail.com>
Co-authored-by: effectfully <effectfully@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No Changelog Required Add this to skip the Changelog Check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants