GithubHelp home page GithubHelp logo

trumarket-bb's Introduction

TruMarket Project

Tru Market is a blockchain-based platform that connects local producers with global buyers, ensuring transparency and trust in the value chain from farm to table.

Mission

TruMarket's mission is to enable complete traceability in global supply chains using blockchain and smart contracts. This provides customers with a transparent view of product origin, journey, and quality while creating opportunities for sustainable practices among suppliers.

Smart Contracts

Smart contracts secure agreements between parties in a tamper-proof manner, executing terms encoded in a blockchain network, including payments.

Operations and Quality Control

Every operation undergoes real-time inspection, with quality control shared among stakeholders and accessible from any device.

Consumer Access

Consumers can access public data by scanning smart labels to understand a product's history.

Factory Contract

The Factory contract is Upgradeable and creates ERC1155 contracts using the FactoryFunc() function.

Key Functions

  • FactoryFunc(): Creates contracts with specific parameters and stores relevant information.
  • getAddresses(): Returns an array with addresses of each contract.

FinancingContract1155

This contract is ERC1155 and offers several features and functions.

Key Variables

  • amountToFinance
  • investmentFractions
  • fractionPrice
  • buyBackPrice
  • withdraw
  • USDT usdt

Key Functions

  • BuyFraction(uint256 _amount): Enables purchase of fractions with rigorous checks.
  • setBuyBack(uint256 profit): Sets profits and changes contract state.
  • withdrawBuyBack(): Allows profit withdrawal and burning of NFT tokens.
  • withdrawUSDT(): Admin method to withdraw USDT.

Structures and Mappings

  • HistoryFractions: Custom record of purchased fractions.
  • Mappings for balances, investor IDs, amounts, and states.

Events

  • Invest
  • TotalAmountFinanced
  • WithdrawComplete
  • BurnNfts

Additional Function

  • getHistorial(): Returns the history of fractions.

DIAGRAM

Alt text

Sequence Diagram: TruMarket Transaction Flow


skinparam participant {
    BackgroundColor DarkSeaGreen
    BorderColor DarkSlateGray
}

skinparam note {
    BackgroundColor LightYellow
    BorderColor DarkSlateGray
}

participant Buyer
participant "TruMarket" as TruMarket
participant Investors
participant Suppliers

autonumber

== Order ==

Buyer -> TruMarket: Places order
TruMarket -> TruMarket: Creates contract and NFTs
note right: Generates contract\nand NFTs

== Financing ==

TruMarket --> Investors: Offers NFTs
Investors -> TruMarket: Purchase NFTs
note left: Investors\npurchase NFTs

== Transaction and Delivery ==

alt Financing Completed
    TruMarket -> TruMarket: Converts crypto to FIAT
    note right: Converts\ncrypto to FIAT
    TruMarket -> Suppliers: Pays with FIAT
    note right: Pays to\nsuppliers
    Suppliers -> Suppliers: Prepares and ships merchandise
    note right: Prepares and\nships merchandise
    Suppliers --> Buyer: Sends merchandise
    note left: Sends merchandise\nto buyer
    Buyer --> TruMarket: Pays total amount
    note right: Pays total amount
    TruMarket -> TruMarket: Converts FIAT to crypto
    note right: Converts\nFIAT to crypto
    TruMarket -> Investors: Pays profits by repurchasing NFTs
    note left: Pays profits\nto investors
else Financing Not Completed
    TruMarket -> TruMarket: Cancels transaction
    note right: Cancels\ntransaction
end

@enduml

trumarket-bb's People

Contributors

capdeo avatar genamol avatar juanlazarte avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.