GoodDollar / GoodCollective

Monorepo for GoodCollective (Segmented UBI and Direct Payments Pool)
MIT License
3 stars 1 forks source link

GoodCollective

Features

This is the repo for the GoodCollective protocol and dapp, use it to:

Quick Start

Fork or clone the repo

Deploying contracts for local development

To start a local node with the deployed contracts:

  1. run

    cd packages/contracts
    yarn deploy
  2. You can now import types,contracts and deployed addresses see packages/sdk-js/goodcollective/goodcollective.js for example:

    import GoodCollectiveContracts from '@gooddollar/goodcollective-contracts/releases/deployment.json';
    import {
     ProvableNFT,
     DirectPaymentsFactory,
     DirectPaymentsPool,
    } from '@gooddollar/goodcollective-contracts/typechain-types';
    
    const registry = new ethers.Contract(
     GoodCollectiveContracts['31337'][0].contracts.DirectPaymentsFactory.address,
     GoodCollectiveContracts['31337'][0].contracts.DirectPaymentsFactory_Implementation.abi,
     localProvider
    ) as DirectPaymentsFactory;

Using the sdk

NFT architecture

    struct NFTData {
        uint32 nftType; // should be non zero, automatically assigned by the DirectPaymentFactory
        uint16 version; // version should be updatd by the pool/nftType manager
        string nftUri; // extra data related to nft that was minted (usually "proof of..."), or general data like the event types
        EventData[] events; // list of climate action events that this nft represent
    }

    struct EventData {
        uint16 subtype; // event type should be managed by the pool/nftType manager. type number to human readable should be supplied in the ipfs data of the nft or event
        uint32 timestamp; // when event happened (unix timestamp, ie seconds)
        uint256 quantity; // arbitrary quantity relevant to the event, used to calcualte the reward
        string eventUri; //extra data related to event stored on ipfs or other external storage
        address[] contributers; // reward will be split between the event contributers
    }

The direct payments pool will send rewards per each event using the following formula:

eventIndex = find indexOf event.subtype in settings.validEvents
rewardPerContributer = settings.rewardsPerEvent[eventIndex] * event.quantity / contributers.length

Running the app

 cd packages/app
 yarn web (or yarn android or yarn ios)

Directories

The directories that you'll use are:

Solidity contracts
packages/contracts/

React Native Web App
packages/app/

Typescript sdk to interact with the contracts
packages/sdk-js/

💬 Support Chat

Join the telegram support chat 💬 to ask questions and find others building with GoodDollar and GoodCollective

🙏🏽 Support us!

Please check out our ...