DecentraMart is a decentralised marketplace built to utilise the Ethereum blockchain as part of a developer program. This being the case, and due to my other commitments, the UI is unrefined and functionality has been adjusted with the main focus being on delivery of a usable smart contract system and the appropriate tests and documentation.
In this application there is an Admin panel (DmartAdmin.sol
) which manages the user roles (admins and store owners),
providing access control across the whole system. This contract, along with the other core contracts, are owned by the creator.
If you are a store owner then you can interact with the DMartStoreManagement.sol
contract in order to create a store
via the DMartStoreFactory.sol
which creates a Proxy using Proxy.sol
pointing to our master copy of DMartStore.sol
.
Having a proxy factory set up like this allows us to create versions of DMartStore.sol
on the fly, for cheap, removing
a lot of overhead and allowing store owners to own and manage multiple stores easily without causing conflicts!
Shoppers in DecentraMart can interact with the individual DMartStore
's which contain stock lists updated by the owners.
npm run install:tr
-> Install all node and EthPM dependencies- in separate shell:
ganache-cli -p 8545
-> Run ganache instance on port 8545 truffle compile
truffle migrate --network ganache
npm run install:tr
-> Install all node and EthPM dependencies- in separate shell:
ganache-cli -p 8545
-> Run ganache instance on port 8545 truffle compile
truffle test
cd interface
npm install
- Use default settings (Rinkeby) or change
environment.ts
to your chosen network & update contract addresses.. npm start
- visit http://localhost:4200
- If you are getting some errors you are probably using the wrong version of
npm
(should be >= 6.4)
- Load up the app as in
run local dev server
above (I recommend you stick with the default environment on Rinkeby) - To connect to Web3, your MetaMask must be connected to the correct network (as in the one in environment.ts... Rinkeby)
- When you go to http://localhost:4200 you should see the front of the marketplace:
- If your metamask is connected to the right network, you will see your address in the top right, next to your blockie
- This adddress will update if you change your metamask account, or will show an error if you are not connected
- Try to purchase a product from the store.. follow these steps: