final-project-akp18 - Online Marketplace on Blockchain (https://github.com/apatel2018/final-project-akp18)
There are a list of stores on a central marketplace where shoppers can purchase goods posted by the store owners.
The central marketplace is managed by a group of administrators. Admins allow store owners to add stores to the marketplace. Store owners can manage their store’s inventory and funds. Shoppers can visit stores and purchase goods that are in stock using cryptocurrency.
- A market owner opens the web app.
- The web app reads the address and identifies that the user is an owner, showing them owner only functions.
- Market owner can add new admins.
- Market owner can stop the market place in case of emergency.
- An administrator opens the web app.
- The web app reads the address and identifies that the user is an admin, showing them admin only functions, such as managing store owners.
- An admin adds an address to the list of approved store owners, so if the owner of that address logs into the app, they have access to the store owner functions.
- The web app recognizes their address and identifies them as a store owner.
- They are shown the store owner functions.
- They can create a new storefront that will be displayed on the marketplace.
- They can also see the storefronts that they have already created.
- They can click on a storefront to manage it.
- They can add/remove products to the storefront or change any of the products’ prices.
- They can also withdraw any funds that the store has collected from sales.
- The web app does not recognize their address so they are shown the generic shopper application.
- From the main page they can browse all of the storefronts that have been created in the marketplace.
- Clicking on a storefront will take them to a product page.
- They can see a list of products offered by the store, including their price and quantity. Shoppers can purchase a product, which will debit their account and send it to the store.
- The quantity of the item in the store’s inventory will be reduced by the appropriate amount.
-
Make sure you have Ganache installed.
-
Make sure you have the react-script installed.
-
Make sure you have Truffle v4.1.15 installed.
-
Make sure you have MetaMask installed.
-
Download or clone the repository https://github.com/dev-bootcamp-2019/final-project-akp18.git
-
CD into the project and install the dependencies:
$ npm install
-
Make sure you have ganache-cli running on port 8545.(save your mnemonic to be able to get the same setup later) ganache will generate 10 addresses that you can use later to perform different operations.
$ ganache-cli
-
Compile and migrate the smart contracts.
$ truffle compile $ truffle migrate
-
Truffle can run tests written in Solidity or JavaScript against your smart contracts.
$ truffle test
-
Run the webpack server for front-end hot reloading (outside the development console). Smart contract changes must be manually recompiled and migrated. CD into the client directory and run the following command.
// Serves the front-end on http://localhost:3000 $ npm run start
- Login as Market Owner. This will be the default address that was used to deploy the contract.
- Add a new Admin address. Enter the address of market admin and click Add.
- Login as Admin. Switch account using MetaMask plugin.
- Add a new Store Owner to the market place.
- Switch account (using MetaMask) again and now login as Store Owner
- Add a new Store Front by entering the name of the store.
- Switch account (using MetaMask) again and login as Admin.
- Approve pending Store Fronts by entering the store number (e.g. 0, 1, 2..).
- Switch account (using MetaMask) again and login as Store Owner.
- Add new Products. Please note that you can only manage store fronts that have been approved by market admin.
- Update an existing Product.
- Remove an existing Product.
- Switch account (using MetaMask) again and login as Shopper
- Browse different Store Fronts. You will have to click on the Browse Products button once you select a store front from the store front drop-down menu.
- Buy a Product by selecting the SKU of the product that you want to buy.
- Switch account (using MetaMask) again and login as Store Owner.
- Withdraw collected amount. Refresh the page to see the updated balance in the page header.
- Switch account (using MetaMask) again. Login as Owner.
- Stop Market Place in case of emergency. You will no longer be able to perform any operations (read only) in the market place. Refresh the page to see the updated market place status in the page header.
- Run the app on a dev server locally for testing/grading
- You should be able to visit a URL and interact with the application
- App recognizes current account
- Sign transactions using MetaMask or uPort
- Contract state is updated
- Update reflected in UI
- Write 5 tests for each contract you wrote
- Solidity or JavaScript
- Explain why you wrote those tests
- Tests run with truffle test
- Implement a circuit breaker (emergency stop) pattern
- What other design patterns have you used / not used?
- Why did you choose the patterns that you did?
- Why not others?
- Explain what measures you’ve taken to ensure that your contracts are not susceptible to common attacks
- Use a library or extend a contract
- Via EthPM or write your own
- Deploy contract on testnet - Ropsen
- Test contracts with travis CI
- Add functionality that allows store owners to create an auction for an individual item in their store
- Give store owners the option to accept any ERC-20 token
- Implement an upgradable design pattern
- Write a smart contract in LLL or Vyper
- Use Ethereum Name Service, uPort, Oracle
- Host website on IPFS http://127.0.0.1:8080/ipfs/QmZtjoGDNZorV7V4tFuDnnKVZHTMuSbof9KjkiRpwcCFyW/
https://ipfs.io/ipfs/QmZtjoGDNZorV7V4tFuDnnKVZHTMuSbof9KjkiRpwcCFyW/