Build a Decentralized Bike Rental App on Binance Smart Chain

Members Only - Join Imposter Devs and you'll get access to this lesson, all lessons, and all courses.

A bonus lesson for you to implement. Creating an owner dashboard where he or she can view the balance of the contract, their cut of that balance, and a feature to withdraw their earnings.

Tips

  1. Create a /admin route for your Owner dashboard. In the OwnerDashboard component have two StatsCards. One displays the balance of the entire smart contract, and the other displays the ownerBalance.
  2. Create a getOwnerBalance() function and ownerWithdraw() function in your BlockChainContext based on the functionalities we added to the smart contract in the last video
  3. Create a WithdrawForm component, with just a button, where you can withdraw out the ownerBalance money.
  4. Add an isOwner() that returns a bool to test if your current user is the owner. If not, then have the Admin route/page say "You are not authorized for this page," otherwise, show the owner deets. 

Github Code

Try it on your own before you take a peek!
https://github.com/rodgtr1/bike-rental-app-web3/tree/bonus