Git Product home page Git Product logo

giveth / giveth-dapp Goto Github PK

View Code? Open in Web Editor NEW
359.0 30.0 231.0 14.66 MB

Giveth Dapp for crowdfunding and managing donations on the ethereum blockchain.

Home Page: https://beta.giveth.io

License: GNU General Public License v3.0

HTML 0.43% JavaScript 94.39% SCSS 5.17%
dapp testrpc wallet blockchain-dapp ethereum-dapp giveth blockchain-charity ethereum-charity ether-donation json-wallet

giveth-dapp's Introduction

TEST Giveth Dapp

DApp - Donation Application for charitable giving without losing ownership

Welcome to the code for Giveth's DApp. This is an open source effort to realize the potential of ethereum smart contracts. More specifically, the Giveth DApp provides an alternative to traditional donation.

Table of content

Getting Started

In the following sections you will learn all you need to know to run the DApp locally and to start contributing. All the steps are also described in this amazing Video Tutorial Walkthrough by Oz.

Prerequisites

  • You need to use NodeJS v10 LTS.
  • You need to use yarn (v1.22.10 or higher) to correctly install the dependencies.
  • You need to have git.

Install

  1. Click Star on this repo near the top-right corner of this web page (if you want to).
  2. Join us on Element or Discord if you haven't already.
  3. Fork this repo by clicking Fork button in top-right corner of this web page. Continue to follow instruction steps from your own giveth-dapp repo.
  4. Clone your own "giveth-dapp" repo. Copy the link from the "Clone or download" button near the top right of this repo's home page.
  5. The rest of these steps must be done from your machine's command line. See the OSX and Linux or Windows section to continue.

OSX and Linux

If your operative system is any distribution of linux you can use an All-in-One installation scripts special thanks to Dapp contributor Jurek Brisbane, available here along with a youtube video, otherwise try the following:

  1. From the desired directory you wish to copy the "giveth-dapp" folder with source files to.
    git clone {paste your own repo link here}
    
    NOTE: Please use develop branch for contributing.
    git clone -b develop {paste your own repo link here}
    
  2. Change directories to giveth-dapp:
    cd giveth-dapp
    
  3. Make sure you have NodeJS (v10) and yarn (v1.22.10 or higher) installed.
  4. Install dependencies from within giveth-dapp directory:
    yarn install
    
  5. That is it, you are now ready to run the giveth-dapp! Head to the Run DApp section for further instructions.

Windows

  1. Install the latest version of Python from this Link. (make sure python is added to $PATH)
  2. Install Microsoft Visual Studio 2017 (double-check the version) from this link. Giveth-Dapp needs the node-gyp module and node-gyp needs VS C++ 2017 Build Tools to be installed.
  3. After downloading, install the packages marked from this image.
  4. Then run command below in command prompt
    npm config set msvs_version 2017
    
  5. After installing the above, you should install NodeJS version 10 LTS (it is better to be v10.24.1 LTS).
  6. Download and run the node-v10.24.1-x64.msi installer and then continue through the installation as normal. Be sure to have the "Enable in PATH" option enabled before installing.
  7. Open the command line in administrator mode by right-clicking on the cmd.exe application and selecting "Run as administrator"
  8. In the administrator command prompt, change to the directory where you want to store this repository.
    cd C:\some\directory\for\repositories
    
  9. Double-check the node version with CMD command:
    node -v
    
  10. After that, install the latest version of Yarn. Be careful not to install packages with NPM. If you have already tried "npm install", you should first delete "node modules" folder.
    yarn install
    
  11. That is it, you are now ready to run the giveth-dapp! Head to the Run dapp section for further instructions.

Run

  1. The Giveth dapp will need to connect to a feathers-giveth server. Follow the feathers-giveth readme instructions to install and run server before proceeding further. Alternatively, you could change the configuration to connect to the develop environment, see the Configuration section.

  2. Start the dapp.

    npm start
    
  3. Once the dapp is up in your browser, click "Sign In" from the main menu.

  4. For testing locally, choose any of the wallet files found in the giveth-dapp/keystores/ folder using the wallet password: password. DO NOT USE THESE ON ANY MAINNET EVMs.

  5. Using the test token To use the test token you need to import the keystore.json you use for your account to MetaMask. After importing, click on 'Add token' > 'Custom token' and enter the MiniMe Token address that can be found when deploying the contracts (should be 0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab by default but make sure to check) The token balance should show up automatically, and the token symbol is MMT. However, in the dApp the token symbol is referred to as ANT, b/c the dapp needs to be able to fetch a conversion rate.

NOTE: When resetting feathers or redeploying the contracts, you need to remove the keystore from metamask and follow this procedure again.

Build

npm run build

NOTE: due to some web3 libraries that are not transpiled from es6, we have to use our giveth-react-scripts fork of react-scripts .

Configuration

The DApp has several node environment variables which can be used to alter the DApp behaviour without changing the code. You can set them through .env or .env.local files in the DApp folder.

Variable name Default Value Description
PORT 3010 Port on which the DApp runs
REACT_APP_ENVIRONMENT 'localhost' To which feathers environment should the DApp connect. By default it connects to localhost feathers. Allowed values are: localhost, develop, release, alpha, mainnet. See Deployment Environments.
REACT_APP_DECIMALS 8 How many decimal should be shown for cryptocurrency values. Note that the calculations are still done with 18 decimals.
REACT_APP_FEATHERJS_CONNECTION_URL Differs per REACT_APP_ENVIRONMENT Overwrites the environment injected feathers connection URL.
REACT_APP_NODE_CONNECTION_URL Differs per REACT_APP_ENVIRONMENT Overwrites the EVM node connection URL for making EVM transactions.
REACT_APP_LIQUIDPLEDGING_ADDRESS Differs per REACT_APP_ENVIRONMENT Overwrites the Liquid Pledging contract address.
REACT_APP_DAC_FACTORY_ADDRESS Differs per REACT_APP_ENVIRONMENT Overwrites the Communities contract address.
REACT_APP_CAMPAIGN_FACTORY_ADDRESS Differs per REACT_APP_ENVIRONMENT Overwrites the Campaign Factory contract address.
REACT_APP_MILESTONE_FACTORY_ADDRESS Differs per REACT_APP_ENVIRONMENT Overwrites the MilestoneFactory contract address.
REACT_APP_TOKEN_ADDRESSES Differs per REACT_APP_ENVIRONMENT Overwrites the bridged token addresses. This is a JSON object string w/ token name : token address.
REACT_APP_BLOCKEXPLORER Differs per REACT_APP_ENVIRONMENT Overwrites the block explorer base URL. The DApp assumes such blockexplorer api is \<BLOCKEXPLORER\>/tx/\<TRANSACTION_HASH\>
REACT_APP_DEFAULT_GASPRICE 10 Overwrites the default gasPrice that is used if ethgasstation service is down. The value is in gwei.
REACT_APP_ANALYTICS_KEY "" Overwrites Segment analytics key

Example of .env.local file that makes the DApp run on port 8080, connects to the develop environment and uses custom blockexplorer:

PORT=8080
REACT_APP_ENVIRONMENT='develop'
REACT_APP_BLOCKEXPLORER='www.awesomeopensourceexplorer.io'

The rest of the configuration can be found in configuration.js

Analytics

Segment Analytics can be enabled by setting REACT_APP_ANALYTICS_KEY

Query Strings

The milestone creation/proposal view now supports query string arguments! The following arguments are available:

Argument Expected Values Type
title The title of the milestone string
description The description of the milestone string
recipientAddress The address of the recipient string
reviewerAddress The address of the reviewer string
selectedFiatType A valid fiat type (i.e. USD) string
date A valid milestone date string string
token A valid token symbol (i.e. DAI) string
tokenAddress A valid token address string
maxAmount A valid max amount of ETH or token number
fiatAmount A valid max amount of fiat (dependant on selectedFiatType) number
isCapped Determines whether the milestone should be capped 0 or 1 (boolean)
requireReviewer Determines whether the milestone should require a reviewer 0 or 1 (boolean)

Contributing

The DApp is fully open-source software, and we would love to have your helping hand! See CONTRIBUTING.md for more information on what we're looking for and how to get started. You can then look for issues labeled good first issue or help wanted. We regularly reward contributions with ether using the Reward DAO.

If you are not a developer, you can still help us by testing new releases periodically. See the Release Process section.

If you want to better understand how does the development process works, please refer to our wiki pages, especially to the Product Definition, Product Roadmap and Development Process & Quality Assurance.

Local Development

At first you would like to run the DApp locally. When running testrpc locally in deterministic mode, you can use any of the keystores in the giveth-dapp/keystores as your wallet. This will provide you access to the testrpc accounts for local development. Each keystore uses the same password: password. DO NOT USE THESE ON ANY MAINNET EVMs

The keystores are seeded with 10.000 ANT tokens for testing donations. To get started with testing donations, make sure to add your account's keystore to MetaMask and swith MetaMask to Ganache. The donation modal should then show the appropriate balance when donating in ANT tokens.

NOTE: If you get a nonce error in MetaMask or if the dapp fails to load with your metamask unlocked, it could be b/c metamask is confused. You should go to "settings" -> "Reset Account" in MetaMask in order to reset the nonce & cached account data.

Development and PR Testing

  1. The Giveth Dapp is auto deployed from the develop branch and is live on Rinkeby develop.giveth.io. All pull requests are autodeployed and the PR preview will be generated upon submission. To learn how to access PR previews see Development Process & Quality Assurance on our wiki.
  2. In order to use the dapp you will need to create account. If this is your first time, click "sign up" to create an account. If you already have a valid keychain file, use it to sign in.
  3. You will need test ether on the Rinkeby network. Go to the "wallet" page to see your new address (0x..). Copy that address and use the faucet to get some: https://faucet.rinkeby.io/

Deployment Environments

At Giveth, we are using the gitflow branching model to deploy to 4 different environments.

Name Blockchain Branch Deployed Auto Deploy Use
mainnet Ethereum Main Network master no Main network deployment for now abandoned due to high transaction costs until sustainable solution is found.
alpha Rinkeby Test Network master no Environment used as a production version until scalability is resolved.
release Rinkeby Test Network release yes Environment for release candidate quality control testing by non-devs.
develop Rinkeby Test Network develop yes Development environment for integrating new features. Feature and pull request branches are also automatically deployed to this environment.

You can change the environment to which the DApp connects through the node environment variables. See the Configuration section for more details.

Release Process

The development uses the Gitflow process with 2 weeks long sprints. This means there is new release to be tested every fortnight. We invite contributors to help us test the DApp in the release environment before we merge it to the master branch and deploy to production environments. If you are interested, write to the DApp Development channel on Element . You can read more about the release planning on our wiki.

Help

Reach out to us on Element or Discord for any help or to share ideas.

giveth-dapp's People

Contributors

alonski avatar aminlatifi avatar anshumanv avatar arbreton avatar ascariandrea avatar bowensanders avatar caseyhelbling avatar deamme avatar dependabot[bot] avatar elmejorge avatar ewingrj avatar frederikbolding avatar geleeroyale avatar griffgreen avatar horus2021 avatar krrisis avatar mahdine avatar mdehghani avatar millnitzluan avatar mohammadpch avatar mohammadranjbarz avatar nadirlaskar avatar ojones avatar ramramez avatar rickk137 avatar rnbwd avatar rudin avatar satyavh avatar twmilli avatar vojtechsimetka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

giveth-dapp's Issues

add my-milestones page

should show current state and available actions for any milestones I'm involved with. This can be as a reviewer or recipient.

  1. do we need the "maker" and "fundraiser" roles (https://drive.google.com/drive/folders/0BzJyIRYTXoqUaXh1b1RDYlplQlE & https://drive.google.com/drive/folders/0BzJyIRYTXoqUaXh1b1RDYlplQlE)
  2. do we have the accept/propose flow
  3. arbitrator?
  • set maxAmount (funding limit)
  • mark milestone complete
  • cancel milestone
  • approve completed milestone
  • reject completed milestone
  • withdraw

fix img uploads if there is an img already attached

currently if I edit a campaign, cause, milestone, or user profile, I need to re-upload my image to get the form to validate.

If there is an image uploaded, we shouldn't have to re-upload just to edit the description for ex.

handle refund flow

using the vault, there is a time delay before the user can actually take the money out of the vault. So when a user takes back control of a donation, it is still locked in the vault for a few days. Then they need to withdraw to their wallet.

we need to incorporate this into the donations page.

show "pending transaction" donations

when viewing the donations (my-donations, a dac/campaign) we should show "incoming/pending" donations.

a donation is pending if "donation.noteId === 0"

If a campaign delegates to a dac, the `my-donations` page for original owner is not clear that they have committed the funds to the campaign

To reproduce...

  1. donate to a campaign
  2. campaign delegates to a dac
  3. view my-donations from the donor's profile

The status of the donation is "waiting for further delegation" and the donated to is the "dac". This is misleading as this "donation" from the user's perspective looks the exact same as if they donated to the dac (and still have control), however since they donated to a campaign first, they don't control the funds.

Either don't allow campaigns to delegate to a dac, or find a way to display this better

fix form validation

If I want to edit my dac description, I can't save (btn disabled) unless I upload an img.

we should check all forms

Don't send tx first time a user makes a profile if there is no eth

The typical flow is that a user will create a wallet and then get redirected to the profile page. If we detect that the user doesn't have a giverId when saving their profile, we try and send a transaction to register the user in liquidPledging. This is problematic because most users will not have any eth since they just created a wallet and will get an error.

Need to only send the tx if they have eth

Can not start campaign with locked wallet

The Start Campaign button does not work if the wallet is locked but you can still create a DAC. Except for some graphical glitches, clicking the button does nothing.

Implement Connect with LinkedIn on user profile

As discussed:

  1. as a method to validate someone's email address.
  2. as a way for donators to validate a campaign / DAC experience
  3. as a way for donators to have social proof of that experience (like you could literally ask connections of the DAC owner how reliable that person is).

prevent donation to canceled milestones

we shouldn't be able to donate to canceled milestones in the dapp.

LiquidPledging will not throw when donating to a canceled milestone, so we need to prevent this in the dapp. With liquidPledging, if a donation is made to a canceled milestone, the tx successfully completes, but the funds end up in a note that the owner controls.

call `addDonor` for user if they haven't done this

We need to call addDonor for a user before they can donate. We call this the first time a user creates their profile. However it is not mandatory to create a profile, so we need to inform the user that they need to call addDonor before they push the donate button.

Balance is 0 ETH warning

Add pup-up warning if the ether balance is too low to make any action. This pop-up will include options how ether can be obtained.

integrate gasstation API

we currently send & sign a tx on behalf of the user.

we should show a confirmation dialog before sending the tx

GivethWallet will not unlock when switching wallets

If I sign in with 1 wallet after a page reload, I can unlock it and successfully make transactions. However if I try and switch wallets, for some reason the GivethWallet instance will unlock successfully, but will not remember the state, thus I can't make a transaction.

My guess is this has to do with either the animationFrame hackery or the use of WeakMap in the GivethWallet itself

replace `currentUser` with the user's profile

currentUser is an address. However we often need information for the user's profile (ex. when donating).

replace the state.currentUser in Application.js to contain the user's profile

Wallet balance should be reactive and consider pending transactions

When user tries to donate multiple time, the wallet balance does not indicate any pending donations. For example I have 4 ETH, I donate 2 to one DAC and then I try to donate 1 to a campaign. However, the donation window still shows 4 ETH (it should at least indicate that 2 of that are pending).

inform user they can't donate before their "donorId" has been assigned/mined

currently we disable the donate button if the user doesn't have a donorId. This is necessary as liquidPledging will through if a donation happens w/o a noteManager.

We should inform the user that we are waiting for their "profile" to be created on-chain and they can only donate after that has happened

my-milestones shouldn't be able to mark complete if there are 0 donations?

If there are no donations to a milestone, we should not allow the owner to markComplete, only to cancel.

If we allow them to mark complete and it is approved by the reviewer, then the milestone will have a requestWithdraw button, but there will never be anything to withdraw.

So I guess we have 2 options.

  1. allow owner to markComplete but do not show the requestWithdraw btn if there are 0 donations.
  2. don't allow owner to markComplete if there are no donations

Maybe the 1st option is better so the campaign can show they are getting stuff done

my-causes view should show "pending" dac

when a user creates a dac, there is a wait until the tx is mined. We should show these "pending" dacs in the my-causes view.

a cause is "pending" if cause.delegateId === 0

Implement Connect with LinkedIn on user profile

@satyavh commented on Tue Sep 26 2017

As discussed:

  1. as a method to validate someone's email address.
  2. as a way for donators to validate a campaign / DAC experience
  3. as a way for donators to have social proof of that experience (like you could literally ask connections of the DAC owner how reliable that person is).

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.