Here's a well-formatted README guide for your TrustTrade Web App, ready for your GitHub project:
This guide provides a step-by-step walkthrough for conducting a complete trade lifecycle, from creation to dispute resolution, using the TrustTrade web application.
- Open your terminal in the
trust-trade-appproject folder. - Run the development server:
npm run dev
- Open your browser and navigate to
http://localhost:3000.
- Connect Wallet: Click the "Connect Wallet" button in the top-right corner of the application and approve the connection in MetaMask. Ensure you're connected to the Amoy Testnet.
- Fill Form: Complete the "Create a New Escrow Trade" form with the seller's address and all relevant trade details.
- Submit Transaction: Click the "Create Trade" button and confirm the transaction in the MetaMask pop-up.
- Get Contract Address: Once the transaction successfully goes through, locate the new contract address. For testing purposes, you can typically find this in the console output where your Hardhat scripts were running.
- Switch Accounts: In MetaMask, switch to the wallet account you designated as the seller for this trade.
- Navigate to Trade Page: Go to the URL for the newly created trade:
http://localhost:3000/trade/[the-new-contract-address]. Remember to replace[the-new-contract-address]with the actual address you copied earlier. - Confirm Trade: The page will display the trade details along with a prominent green "Confirm Trade Details" button. Click it and confirm the transaction in MetaMask.
The status on the page will automatically update to
AWAITING_DELIVERY.
- Switch Accounts: Switch back to the Buyer's account in MetaMask.
- Refresh Page: Refresh the trade details page in your browser.
- Choose Action: You will now see two possible actions:
- To complete the trade: Click "Confirm Delivery" and approve the transaction. This will release the funds to the seller, and the trade status will become
COMPLETE. - To start a dispute: Click "Raise Dispute" and approve the transaction. The trade status will then change to
DISPUTED.
- To complete the trade: Click "Confirm Delivery" and approve the transaction. This will release the funds to the seller, and the trade status will become
- Switch MetaMask to any account that you included in the voter list.
- Navigate to the trade page. You'll find buttons to "Vote to Refund Buyer" or "Vote to Pay Seller".
- Click your desired vote and confirm the transaction. Repeat this process for any other voters you wish to simulate.
- After all desired votes have been cast, click the "Tally Votes & Resolve" button on the trade page and confirm the transaction.
- The smart contract will either resolve the dispute and release the funds based on the votes, or the trade status will change to
AWAITING_PHASE_2if the votes were inconclusive.
- If the trade status is
AWAITING_PHASE_2, switch MetaMask to the Chief Arbitrator's account. - Navigate to the trade page. You'll now see buttons to "Resolve for Buyer" or "Resolve for Seller".
- Click your final decision and confirm the transaction to release the funds and conclude the dispute.