From a9ba8f274bc5ac5c350b7777151246df549ed2ab Mon Sep 17 00:00:00 2001 From: Charles Ouimet Date: Fri, 24 Jan 2025 08:01:01 -0500 Subject: [PATCH] [docs] Add `Running a Full Demo` section at the end of the `README` Ref: https://dappuniversity.slack.com/archives/CSZT3U5UG/p1737554940693009 --- README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 440e6da..47066bf 100644 --- a/README.md +++ b/README.md @@ -28,4 +28,51 @@ In a separate terminal execute: `$ npx hardhat run ./scripts/deploy.js --network localhost` ### 7. Start frontend -`$ npm run start` \ No newline at end of file +`$ npm run start` + +## Running a Full Demo + +This demo uses a Hardhat deployment script that initializes 4 predefined accounts: + +- **`buyer`**: Account with index 0 in Hardhat +- **`seller`**: Account with index 1 in Hardhat +- **`inspector`**: Account with index 2 in Hardhat +- **`lender`**: Account with index 3 in Hardhat + +### Prerequisites + +1. Map the above accounts to your **Metamask wallet**: + - Import the private keys for these accounts into Metamask if you haven't already. + +--- + +### Steps to Complete a Property Purchase + +1. **Open the Demo App**: Navigate to [http://localhost:3000](http://localhost:3000) in your browser. +1. **Connect Metamask**: Connect your wallet to the app. + - The currently active account in Metamask doesn't matter during this step. +1. **Select a Property**: Click on a property to view its details. +1. **Perform Actions with the Specified Accounts**: + - **Inspector**: + - Switch to the `inspector` account in Metamask. + - Click `Approve Inspection` and confirm the transaction in Metamask. + - **Lender**: + - Switch to the `lender` account in Metamask. + - Click `Approve and Lend` and confirm the transaction in Metamask. + - **Buyer**: + - Switch to the `buyer` account in Metamask. + - Click `Buy` and confirm the transaction in Metamask. + - **Seller**: + - Switch to the `seller` account in Metamask. + - Click `Approve & Sell` and confirm the transaction in Metamask. + +--- + +### Expected Result + +After completing the last step, the property details should display: +**"Owned by 0xf39F...2266"** + +This indicates that the property is now owned by the `buyer` account (`0xf39F...2266`), which corresponds to index 0 in Hardhat. + +**Note**: Hardhat initializes account addresses in a predictable way when starting up, ensuring consistent behavior during each run.