Giter VIP home page Giter VIP logo

sweet-caramel's Introduction

Popcorn

Codacy Badge

Technology Used

Directory structure

packages
├── app            [@popcorn/app]          [next.js]
├── hardhat        [@popcorn/hardhat]      [solidity contracts & typechain]
├── scripts        [@popcorn/scripts]      [deploy scripts, etc]
├── utils          [@popcorn/utils]        [generic utils]
├── ui             [@popcorn/ui]           [ui components + storybook]
└── ... etc

Prerequisites

  1. Install packages:
    • yarn install

Getting started with development

  1. To start the nextjs app and a local hardhat node run:
yarn lerna run dev  --parallel
  1. Then in another terminal you can deploy the contracts with some fixtures.
yarn hardhat dev:deploy --network localhost

This will deploy all contracts and create 3 elections with pre-registered beneficiaries with the following attributes:

  1. Monthly (Accelerated Voting Enabled)
  2. Quarterly (Accelerated Voting Enabled)
  3. Yearly (Default Configuration)

To update the election state (for instance, to change from registration period to voting period for the elections with accelerated voting enabled), you can run this command:

yarn hardhat elections:refreshElectionState --term 1 --network localhost
  1. copy .env.example to .env and update it with the contract addresses output in the previous command.

Getting started with Frontend

  1. Install packages

    • yarn install
  2. Run dev (watch files and start up frontend)

    • yarn lerna run dev --parallel
  3. Start storybook (optional):

    • yarn lerna run story --parallel

Getting started with Contracts

To run tests: go to packages/contracts yarn hardhat test

Deploy from packages/contracts:

  1. compile: yarn hardhat compile
  2. in one terminal: yarn hardhat node
  3. in another terminal: yarn hardhat dev:deploy

Default Service Locations

Service Location
Next.js Frontend http://localhost:3000
Storybook run: yarn lerna run story

Useful Commands

Command Description
yarn install equivalent to npm install
yarn add @org/packagename equivalent to npm install - will add to dependencies
yarn add @org/packagename -D equivalent to npm install --save-dev - will add to devDependencies
lerna dev --parallel run package.json "dev" script on all projects
lerna run dev --scope=@popcorn/app run package.json "dev" script only on frontend package
lerna run story start storybook
lerna run test --parallel run tests

Useful Hardhat Commands

Command Description
yarn hardhat dev:deploy deploy contracts for development
yarn hardhat elections:refreshElectionState --term 1 --network localhost refresh election state
yarn hardhat elections:getElectionMetadata --term 1 --network localhost get metadata for election term
yarn lerna run --scope @popcorn/hardhat docify generate documentation for contracts (found in packages/contracts/docgen/docs)

Contributing

Contributions are welcome! Please raise a pull request with your contributions.

Popcorn follows the Contributor Covenant Code of Conduct.

sweet-caramel's People

Contributors

anthonymartin avatar redveil avatar mefuru avatar saharap avatar stanley-okwii avatar ecmendenhall avatar miloops avatar partywave avatar amirjab21 avatar soptq avatar yaoandrew avatar the-emerald avatar leetdev avatar izayl avatar codacy-badger avatar

Watchers

James Cloos 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.