Skip to content

Decentralized bar which uses a ERC20 token to manage all its transactions (buy drinks, play games...)

Notifications You must be signed in to change notification settings

eLSeR17/blacktown-bar

Repository files navigation

Blacktown Bar

This has been updated to work with Goerli over Rinkeby

You can also see the python/brownie version of this here.

About

Blacktown Bar

This repo represents a decentralized bar as a DAO in which all the transactions (buy drinks, play games, etc.) are registered in the blockchain. The bar uses its own ERC20 token to manage all the operations. As a DAO, proposals will be allowed.

Feature On-Chain Governance Hybrid Governance
Gas Costs More Expensive Cheaper
Components Just the blockchain An oracle or trusted multisig

Getting Started

Work with this repo in the browser (optional)

It's recommended that you've gone through the hardhat getting started documentation before proceeding here.

Requirements

  • git
    • You'll know you did it right if you can run git --version and you see a response like git version x.x.x
  • Nodejs
    • You'll know you've installed nodejs right if you can run:
      • node --versionand get an ouput like: vx.x.x
  • Yarn instead of npm
    • You'll know you've installed yarn right if you can run:
      • yarn --version And get an output like: x.x.x
      • You might need to install it with npm

Installation

  1. Clone this repo:
git clone https://github.com/eLSeR17/blacktown-bar
cd blacktown-bar
  1. Install dependencies
yarn

or

npm i 
  1. Run the test suite (which also has all the functionality)
yarn hardhat test

or

npx hardhat test

If you want to deploy to a testnet: 4. Add a .env file with the same contents of .env.example, but replaced with your variables. WARNING WARNING WARNING

DO NOT PUSH YOUR PRIVATE_KEY TO GITHUB

Usage

On-Chain Governance Example

Here is the rundown of what the test suite does.

  1. We will deploy the ERC20 token "BlacktownToken" which we will use to control the bar.
  2. We will deploy a Timelock contract that we will use to give a buffer between executing proposals.
    1. Note: The timelock is the contract that will handle all the money, ownerships, etc
  3. We will deploy our Governence contract
    1. Note: The Governance contract is in charge of proposals and such, but the Timelock executes!
  4. We will deploy the bar's main contract, which will be owned by our governance process! (aka, our timelock contract).
  5. We will propose a price to be changed in our bar contract.
  6. We will then vote on that proposal.
  7. We will then queue the proposal to be executed.
  8. Then, we will execute it!

Additionally, you can do it all manually on your own local network like so:

  1. Setup local blockchain
yarn hardhat node
  1. Propose a new value to be added to our Box contract

In a second terminal (leave your blockchain running)

yarn hardhat run scripts/propose.ts --network localhost
  1. Vote on that proposal
yarn hardhat run scripts/vote.ts --network localhost
  1. Queue & Execute proposal!
yarn hardhat run scripts/queue-and-execute.ts --network localhost

You can also use the Openzeppelin contract wizard to get other contracts to work with variations of this governance contract.

Off-Chain governance Example

This sectoin is still being developed.

Deploy your ERC20 and make proposals in snapshot.

(back to top)

Roadmap

  • [] Add Upgradeability examples with the UUPS proxy pattern
  • [] Add Chainlink Oracle Integration with Snapsafe example

See the open issues for a full list of proposed features (and known issues).

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Hardhat - @HardhatHQ Sergio López - @sergiolopez1771

(back to top)

Acknowledgments

(back to top)

You can check out the openzeppelin javascript tests for a full suite of an example of what is possible.

About

Decentralized bar which uses a ERC20 token to manage all its transactions (buy drinks, play games...)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published