Skip to content

Blockversity-xyz/Sample-DAO

Repository files navigation

Sample-DAO

Overview

Congratulations! This is the first step in your journey towards learning how to build a DAO on the Flow network. This document's objective is to provide the basic tools and help you understand how to use them. You can read the full guide here

All of the code that interacts with Flow is written with Cadence; a new high-level programming language intended for smart contract development.

The tools used for testing the smart contracts, scripts and transactions are written in Go and are part of the Overflow library.

Table of content

Getting Started

To get a local copy up and running, please follow these simple steps.

1. Install Dependencies

2. Clone the project

git clone --depth=1 https://github.com/Blockversity-xyz/Sample-DAO.git

Prerequisites

Here is what you need to be able to run the project.

  • Node.js
  • NPM (recommended)
  • Flow CLI
  • Go

Cadence

Smart Contracts

The smart contracts are written in Cadence and are located in the contracts folder. The contracts are deployed to the testnet using the Flow CLI.

flow project deploy --network testnet

With Flow CLI you can also update the contracts on the testnet.

flow accounts update-contract ./contracts/ExampleDAO/ExampleDAO.cdc --network testnet --signer testnet-account

Transactions

The transactions are written in Cadence and are located in the transactions folder. The transactions are deployed to the testnet using the Flow CLI.

flow transactions send ./transactions/Action.cdc --network testnet

Scripts

The scripts are written in Cadence and are located in the scripts folder. The scripts are executed on the testnet using the Flow CLI.

flow scripts execute ./scripts/GetAccount.cdc --network testnet

Testing

Overflow

The testing framework for the Flow Cadence contract uses Overflow

To test the contracts go to the Cadence folder cd Cadence and run the below command

go run ./tasks/main.go

Testnet

To deploy the contracts to the testnet, you need to have a testnet account. You can create one using the Flow CLI.

Some useful Flow CLI Commands

flow project deploy --network testnet
flow accounts create \
  --key YOUR_PRIVATE_KEY \
  --host access.devnet.nodes.onflow.org:9000 \
  --signer YOUR_ACCOUNT_ADDRESS

Some useful commands

flow project deploy --network testnet
flow transactions send ./transactions/SetupAccount.cdc --network testnet
flow accounts create --key YOUR_PRIVATE_KEY --host access.devnet.nodes.onflow.org:9000 --signer YOUR_ACCOUNT_ADDRESS