Skip to content

smart contract for marketplace interactions between manufacturers and suppliers

Notifications You must be signed in to change notification settings

psahithireddy/supply-chain-smart-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Supply-Chain-Management

A transparent supply chain which can be used by 5 clients and their customers.

Actors

Manufacturers :

There are 2 clients who manufacture cars, and sell them to the customers.For manufacturing cars we need cars_body and wheels.

Suppliers :

There are 3 suppliers.
Supplier 1 (S1) supplies wheels to Manufacturer 1 (M1)
Supplier 3 (S3) supplies cars_body to both M1 and M2.
Supplier 2 (S2) supplies wheels to Manufacturer 2.

Customers :

They buy cars from manufacturers at retail price

Market Interactions

Manufacturers bids to suppliers and bids are secret. Once auction is over, resource allocation is based on optimal resource allocation and profit maximising strategy.

Goals

We ensure 3 goals are met :

  1. Secret Bidding
  2. Optimal resource allocation & Profit maximization
  3. Validity of the product

To test in truffle

  • Compile:
truffle compile
  • Open console in development mode:
truffle develop
  • Deploy
truffle deploy
  • Start contract
let instance = await Marketplace.deployed()
  • Call a function
instance.function(args)
  • Get a mapping:
var balance = await instance.<mapping name>.call(account);
console.log(balance);

Rough documentation for us right now

Functions

  • supplierStartAuction : suppliers can start their auctions
  • supplierEndAuction : suppliers can end their auctions
  • supplierEndReveal : Reveal phase of the bidding is finished and allocation happens now (implements resource optimal allocation)
  • transferMoney : transfer money
  • manufacturerPlacesBid : manufacturer places bid to supplier from this if bidding phase is on
  • manufactuerRevealBid : manufacturer reveals their bid to supplier from this if reveal phase is on
  • addSupplier, addManufacturer, addCustomer : adds the actors
  • supplierAddQuantity : adds quantity for the supplier
  • updateManufacturerQuantities : updates cars from quantities;
  • manufacturerSuppliesCars : manufacturer sells cars
  • customerPurchase : customer places a order
  • set_cars_price : manufacturer can set cars price
  • get_cars_price : returns quantity and price (per each piece) by the mentioned manufacturer

Events

  • StartSupplierAuction : supplier starts auction
  • EndSupplierAuction : supplier ends auction
  • AllocateFromSupplier : supplier sends goods to manufacturer
  • ManufacturerBids : manufacturer places a bid to the supplier
  • ManufacturerReveal : manufacturer reveals their bid to the supplier
  • CustomerRequest : customer requested for a purchase from manufacturer
  • AllocateFromManufacturer : manufacturer supplied to customer

Note points

  • Only 1 bid per auction is supported. Incase of multiple bids, first bid is considered
  • keccak256 encryption for hiding the bids
  • no penalties right now for incorrect reveals, just ignore from auction

About

smart contract for marketplace interactions between manufacturers and suppliers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published