-
Notifications
You must be signed in to change notification settings - Fork 479
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
Conversation
Cool! |
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. |
@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? |
|
I haven't reviewed the whole thing yet, but I found a few issues we might want to make a decision about:
|
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>
There was a problem hiding this 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.
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>
doc/docusaurus/docs/auction-smart-contract/end-to-end/placing-bids.md
Outdated
Show resolved
Hide resolved
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>
Rebase off master to fix the failing PlutusTx Template check |
JFYI: I am in the process of reviewing this PR... |
doc/docusaurus/docs/auction-smart-contract/end-to-end/generating-keys.md
Show resolved
Hide resolved
doc/docusaurus/docs/auction-smart-contract/end-to-end/generating-keys.md
Outdated
Show resolved
Hide resolved
…ng-keys.md Co-authored-by: Robertino <48034748+rober-m@users.noreply.github.com>
doc/docusaurus/docs/auction-smart-contract/end-to-end/generating-keys.md
Show resolved
Hide resolved
node send-lovelace.mjs bidder1 | ||
node send-lovelace.mjs bidder2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node send-lovelace.mjs bidder1 | |
node send-lovelace.mjs bidder2 | |
pushd off-chain | |
node send-lovelace.mjs bidder1 | |
node send-lovelace.mjs bidder2 | |
popd |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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`. |
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
… 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>
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
, runnix develop
, then runyarn install
followed byyarn start
.If you prefer reviewing it on GH, you may want to review the files in this order:
But note that code embedding won't work.
@rober-m @jinglescode feedback welcome