/AgriculturalMarketplaceCrowdfunding

Primary LanguageJavaScriptBoost Software License 1.0BSL-1.0

Agricultural Marketplace Crowdfunding

Description

This project aims to solve the problem of publishing & tracking the full supply chain from the product funding campaign through harvest and finally being sold through a agricultural marketplace to the consumers' hands.

This document uses UML to describre the general structure and functions that this Smart Contract offers to the actors:

  • Farmers
  • Investors
  • Donors
  • Consumers (Forward Market/Spot Market)
  • Marketplace Manager

Activity Diagram

This diagram shows the different actors and the interactions with the system.

Activity Diagram

Sequence Diagram

This diagram shows the communication between the different objects and their life cycle.

Sequence Diagram

State Diagram

This diagram shows the different states of each object and the events or conditions that change those states.

State Diagram

Data Modeling Diagram

This diagram shows the different Smart Contracts and the relation between them

Data Modeling Diagram

DApp State Machine

This visualization shows state machine that controls product stages and user interaction navigation in deterministic fashion.

JS Finite state machine Viz

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Please make sure you've already installed ganache-cli, Truffle and enabled MetaMask extension in your browser.

Installation

A step by step series of examples to get a development env running

Clone this repository:

git clone https://github.com/mukulChandYadav/AgriculturalMarketplaceCrowdfunding

Install all requisite npm packages (as listed in package.json):

npm install

Launch Ganache:

ganache-cli -m "drama repeat eagle about favorite garbage battle balance slight catalog surround visual"

In a separate terminal window, Compile & migrate smart contracts:

Migration deploys smart contracts to the locally running blockchain, ganache-cli:

truffle migrate

This will create the smart contract artifacts in folder src\artifacts\ and deploy them to local blockchain.

Test smart contracts by running another blockchain on test network:

ganache-cli -m <mnemonic> -p 8546
truffle test --network test

All 15 tests should pass.

truffle test

In a separate terminal window, launch the DApp:

npm run build (Prod/Build)
npm run start (Dev)

Application Workflow

Register User

Users can register to the portal using their Metamask wallet account, in designated role, to perform related tasks on the portal.

Publish Product Campaign

Farmer, as a primary user of the portal, registers and then publishes proposed product campaign to retrieve required amount through crowdfunding as well as enables his product's visibility to marketplace users.

Fund Product

Investors & Donors can fund published product campaigns on Marketplace. Investors intend to derive profit, whereas Users with Donor role don't expect any returns from final product sales.

Harvest Product

The Product Publisher, i.e. Farmer, harvests funded product once ready, earmarking Marketplace manager for further processing. Farmer, hands over all his investor liabilities to Marketplace manager at this stage of supplychain action.

Transfer Harvested Product To Marketplace

The Marketpalce Manager then assumes the ownership of harvested product and then pays expected price to previous owner, i.e. Farmer.

Buy Product From Marketplace

At this juncture of product supplychain, Customers(Spot/Forward), buys product from marketplace at listed price.

Payout Product Campaign Investors

Upon product being sold to customers, Marketplace manager, decides to payout any investors, if applicable.

Rate Marketplace users

Marketplace users, can decide to rate users based upon status & quality of interaction and commitment of current owner of product towards products maturity.

Built With

  • Ethereum - Ethereum is a decentralized platform that runs smart contracts
  • Truffle Framework - Truffle is the most popular development framework for Ethereum with a mission to make your life a whole lot easier.

Authors

  • Abhijeet Kumar
  • Mukul Chand Yadav

Acknowledgments

  • Dr. Richard Newman, UF CISE Department

Credits & References