Coder Social home page Coder Social logo

final-project-t4sk's Introduction

demonitize

Demonetize is a decentralized application for managing recurring payments of ERC20 token.

User Stories

Subscription Creator

An subscription creator creates a contract for recurring payment of a ERC20 token. He then shares this newly created contract address with his potential subscribers. After users have subscribed to this contract, the subscription creator can periodically charge them.

Subscriber

An user subscribes to a subscription contract. Next he approves the subscription contract to spend ERC20 token from his account. The subscription contract will only allow tokens to transfer periodically. Payments will be rejected if the user disapproves this contract to transfer tokens or if the user unsubscribes from this contract.

Payment Processor

As a subscription creator, it can be time consuming to manually charge every subscriber. Therefore he has an option to register his contract for anyone to process his payments on his behalf. In exchange the payment processor receives a fee for his service.

Development

Install dependencies

npm install

Start local blockchain

npm run chain

Deploy contracts

npm run compile
npm run migrate

Start client server

cd web-app
npm install
npm start

Account Setup for Development

  • import accounts 1, 2, 3 from the private keys listed on ganache to MetaMask
    • account 1 will be the subscription creator
    • account 2 will be the subscriber
    • account 3 will be payment processor
  • For each account, import the ERC20 token called TestToken into MetaMask so that token balance can be checked. Contract address is listed on the migration log after npm run migrate

Accounts 1 and 2 are funded with some TestToken.

How to Creating a Subscription

Subscription Creator

  • Create a subscription contract and share his contract address with users he wishes to correct recurring payments from.

drawing

Subscriber

  • Takes the subscription contract address and subscribes to the contract.

drawing

Next he approves the contract to spend his tokens.

drawing

Subscription Creator

  • He charges the subscriber. When the next payment time is reached, refresh the page to see the "Charge" button enabled again.

drawing

How to Set up a Bounty

Subscription Creator

  • Creates a bounty, listing his subscription contract address and a bounty amount rewarded to the payment processor. After creating a bounty, he approves the contract managing the bounties to transfer tokens upon a successful payment.

drawing

How to Claim a Bounty

Payment Processor

  • Finds a bounty and processes the payment. In exchange he receives some tokens.

drawing

Testing

npm run chain
# in another terminal
npm test
Notes

Concat contracts for contract verification

npm run truffle-flattener -- contracts/Contract.sol

final-project-t4sk's People

Contributors

t4sk avatar

Watchers

 avatar  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.