Git Product home page Git Product logo

dao-proposal-basic's Introduction

๐Ÿ›๏ธ Simple DAO with Re-Entrancy Example

Quickly spin up a DAO smart contract where you choose the initial group of members.

PowDAO Dashboard

๐Ÿ“˜ DAO Specifics

Quickly initiate a DAO by sending an array of address in the constructor of this contract on deploy. DAO proposals can be created by anyone, but only voted on by members. Members can create proposals to add or kick members. Members cannot withdraw their deposited funds once they are deposited. All deposited funds will be used for the good of the DAO.

Public Goods... This type of DAO can be used by sports teams to pay for field time, equipment, travel, etc. Another use case is for public contruction or maintenance projects. A neighborhood/ town/ governoment can deposit a bunch of funds which can be democratically voted on and invoices can be submitted by the contractors.

โญ Bonus

A re-entrancy proxy contract has been created to verify the security of the PowDAO contract withdraw function. This contract can be found in packages/hardhat/contracts. To mimic a re-entrancy attack, uncomment the file in the deploy script packages\hardhat\deploy\00_deploy_your_contract.js and uncomment the 2 function calls in the contract itself ('powdao.getPayoutUnsafe(address(this));'). On deploy, this 'attacking' smart contract will create a proposal and if the proposal is approved by DAO members the proposer can withdraw the funds. To create a re-entrancy attack when you are withdrawing your funds, use the 'getPayoutUnsafe' function versus 'getPayout' which does not have the re-entrancy vulnerability.

Re-entrancy is caused by repeatedly calling the a fallback function in the proxy contracts receive function. This will create a loop which will be executed until it runs out of gas making repeated function calls. Try for yourself!

Info on Re-Entrancy Attack

๐Ÿ„โ€โ™‚๏ธ Quick Start

Prerequisites: Node plus Yarn and Git

clone/fork ๐Ÿ— scaffold-eth:

git clone https://github.com/amitchaudhari9121/dao-proposal-basic

cd dao-proposal-basic

install and start your ๐Ÿ‘ทโ€ Hardhat chain:

cd dao-proposal-basic
yarn install
yarn chain

in a second terminal window, start your ๐Ÿ“ฑ frontend:

cd dao-proposal-basic
yarn start

in a third terminal window, ๐Ÿ›ฐ deploy your contract:

cd dao-proposal-basic
yarn deploy

๐Ÿ” Edit your smart contract PowDAO.sol in packages/hardhat/contracts

๐Ÿ“ Edit your frontend App.jsx in packages/react-app/src

๐Ÿ’ผ Edit your deployment scripts in packages/hardhat/deploy

๐Ÿ“ฑ Open http://localhost:3000 to see the app

dao-proposal-basic's People

Contributors

amit-chaudhari1 avatar

Stargazers

 avatar

Watchers

 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.