Coder Social home page Coder Social logo

charlieknoll / dgpv2 Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 116 KB

Application to enable management and verification of funds for a charitable organization using the Ethereum blockchain

License: MIT License

JavaScript 93.83% HTML 6.17%
ethereum-blockchain

dgpv2's Introduction

Distribruted Giving Project Phase 2

Application to enable management and verification of funds for a charitable organization using the Ethereum blockchain

High Level Testing Process Description

The following use cases are tested in the tests/dgp.js file.

  • SuperAdmin deploys contract
  • SuperAdmin funds contract with ETH
  • Admin registers USD donations to their operating bank account which effectively mints DUST
  • Admin registers clients which prefunds the clients' wallets with ETH for gas costs and allocates USD (DUST) to the client
  • Admin registers vendors
  • Clients USD (DUST) vests over time
  • Clients make purchases from vendors
  • Vendors redeem USD

Edge test cases

  • Admin prevented from registering an existing client
  • Admin can redeem DUST for USD for vendors
  • Vendors can refund clients for mistaken purchases
  • Vendors can donate DUST to be recycled into client endowments instead of withdrawaling USD
  • Clients can't make purchase without enough vested DUST

3rd Party Auditing

At any time a 3rd party can read the contracts "accountBalance" field and verify that it matches the Service Providers operating bank account balance. Hopefully a future thinking bank will offer these services by surfacing a simple API, for example:

https://api.wellsfargo.com/verifyBalance?contractAddress=0xfe39fae16d9ab71c3911b40ab2724b6fd7dfb2b8

which would make a blockchain call and retrieve an "Account Verified" code snippet. The would work similarly to site verified badges on websites:

image

This would encourage charitiable giving to the project based on the confidence that the USD funds cannot be misappropriated.

Glossary

User types

  • SuperAdmin: the contract deployer (DGP organization).
  • Admin: Either a service provider account or DGP, the user who sets up vendors and clients.
  • Client: A receiver of USD tokens (DUST). The client only spend DUST at registered vendors according to vesting rules.
  • Vendor: A registered participant who has agreed to recieve DUST from clients for payment of goods or services. The Admin will send real USD to the vendor upon the Vendor's redemption of DUST
  • Supporter: Someone who wishes to donate ETH to the contract to pay for client & vendor expenses

Concepts

  • Disbursement rule: how much DUST becomes available to spend at a given interval
  • Checking Account Balance: the vested remaining spendable DUST available to the client
  • Savings Account Balance: the unvested DUST

Events

Events are raised when transactions occur that need to be logged for reporting purposes

  • USDDonation: records a USD transfer into a Service Provider's bank account
  • UnlockedDeposit: records an immediately spendable deposit of DUST to a client
  • LockedDeposit: records a deposit to the client's savings account which is subject to disbursement rules
  • RemoveClient: records a removal of a client from the contract, all client's DUST is made available to be reallocated to other clients, could be used to reset a client after a period of inactivity
  • Purchase: records a client purchase from a vendor
  • Refund: records a Vendor refunding a client
  • Redemption: records a Vendor requesting redememption of their DUST to USD
  • SupporterETHDonation: records an ETH deposit to the contract, will be used for contract expenses (gas costs)
  • Transfer: records an ETH transfer out of the contract

Gas Estimates

  • { step: 'register donation', gas: 43205 },
  • { step: 'register client', gas: 103055 },
  • { step: 'register client', gas: 88055 },
  • { step: 'register vendor', gas: 43475 },
  • { step: 'make purchase', gas: 86586 },
  • { step: 'make 2nd purchase', gas: 41586 },
  • { step: 'make 3rd purchase', gas: 41586 },
  • { step: 'redeem purchases', gas: 23873 },
  • { step: 'redeem purchases for vendor', gas: 40231 }

At 4 Gwei and $225/ETH it will cost approximately .05 USD per purchase assuming a rolling average of 52,000 gas per purchase eth gasstation calculator

Testing

  • Console1: Run testrpc
  • Open 2nd console
  • npm install
  • truffle migrate --reset
  • node burnBalance-node.js (example to set client accounts to zero balance to mimic unfunded clients)
  • truffle test .\test\dgp.js

dgpv2's People

Contributors

charlieknoll avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mvpratt

dgpv2's Issues

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.