Skip to content

Latest commit

 

History

History
75 lines (39 loc) · 4.5 KB

5_Alonzo-purple-exercise-5.md

File metadata and controls

75 lines (39 loc) · 4.5 KB

Alonzo Purple Testnet Exercise Sheet 5: "Multi-Asset Tokens"

In the fourth exercise, you wrote some simple transactions using datums and redeemers. In this exercise, we will practice managing multi-asset tokens.

Prerequisites

  1. Complete Exercise Sheet 4

  2. Start a passive Cardano node if you need to, and make sure that it has synced with the testnet.

  3. Make sure you have some Alonzo Purple test ada

  4. Read the tutorial information on:

    1. Native tokens and Mary-era minting policies
    2. How to manage native tokens with Plutus, including Plutus minting scripts

Objectives

In the fifth set of exercises, we will make sure that you can:

  1. Mint native tokens using both Mary-era and Plutus scripts
  2. Redeem native tokens
  3. Mint non-fungible tokens, including taking payments
  4. Manage time-based scripts

Exercises

  1. Create a set of private/public signing keys, shelley, and two payment addresses, mary and percy. Fund the addresses with some test Ada.

  2. Define a Mary-era minting script (a "multi-signature" script) that allows shelley to create new Ozymandian tokens. Define a minting policy for the Shelley currency that uses this minting script. Do not use Plutus scripts at this stage.

  3. Mint 1000 new Ozymandians in the percy address by building and submitting a transaction. Check that they have been successfully minted.

cardano-cli query utxo –address $(cat percy)
  1. Define a second minting script that allows shelley to create new SkyLark tokens. Mint 100 SkyLark tokens and send them to percy. Check that the tokens have been received and then send 75 SkyLark tokens to mary.

  2. What is the least amount of Ada that you need to keep in the mary and percy addresses? What is the least amount of Ozymandians or SkyLarks that you can keep in an address?

  3. You want to burn some of your Ozymandians in the percy address_._ How do you do this? What happens to your Ada balances when you burn your tokens?

  4. Define a Plutus minting script that allows you to mint a variable number of Ozymandian and SkyLark tokens (with the numbers supplied via a redeemer). Verify that this works as you expect.

  5. Define a Plutus minting script that allows you to mint a single instance of a non-fungible token. Your script should take a payment from a user-supplied address and pass this payment to an address of your choice.

  6. Adapt your solution from Exercise 8 so that you conduct a Dutch auction on your non-fungible token. For example, start the bidding at 1000 Ada and reduce the price by 1 Ada every second. Sell the non-fungible token to the first client that offers to pay at least the current price. When the price falls below your hidden reserve, reject all future bids.

  7. Adapt your solution from Exercise 9 so that the auction for the non-fungible token starts at a predetermined time. Reject all bids that arrive before the time.

  8. Optional Exercise (Easy to Moderate)

    Publicise your non-fungible token sale and participate in other token sales. Aim to collect the most interesting set of non-fungible tokens. When selling your tokens, you may want to record some metadata on the chain (e.g. representing a digital image or the purchaser's identity) as well as transferring the non-fungible token itself. How can you do this?

  9. Optional Exercise (Moderate)

    Implement a token "factory". You should accept the token, the minting policy and the required number of tokens as parameters to your script and mint the required number of tokens. Does your solution work for both fungible and non-fungible tokens? How do you deal with third-party signatories? Test your solution by allowing another testnet user to mint new tokens using your factory.

Feedback

Please let us know of any problems that you have encountered