Skip to content

Commit

Permalink
Add readme & get build+start working again
Browse files Browse the repository at this point in the history
  • Loading branch information
benefacto committed Dec 29, 2023
1 parent 25577db commit dbb9827
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 241 deletions.
222 changes: 46 additions & 176 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,193 +1,63 @@
# Tezos Homebase
# Homebase DAO Deployer

[![](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)
## Overview

Homebase is a platform designed to let users create and manage DAOs on the Tezos blockchain.
This repository hosts the Homebase DAO Deployer, a lightweight Express server tailored for deploying and managing Decentralized Autonomous Organizations (DAOs) on the Tezos blockchain. Evolved from the original [Tezos Homebase app](https://github.com/dOrgTech/homebase-app), this server focuses on streamlined functionality and reduced redundancy.

# Prerequisites
## Key Features

The following dependencies are required to run homebase-app:
- **Lightweight Deployment**: Quick and efficient deployment of DAOs.
- **Reduced Redundancy**: Removal of superfluous code from the original Homebase app.
- **Core Functionality**: Essential features for effective DAO management are maintained.

| Dependency | Version |
| ---------- | ------------------- |
| Node | `v16.16.0` or above |
| Yarn | `v1.22.*` or above |
## Prerequisites

# Third Party Services
- **Node.js**: Version `v16.15.*` or newer.
- **Yarn**: Version `v1.22.*` or newer.

The following third party services are being used by Homebase:
## Installation and Setup

## [TZKT API](https://api.tzkt.io/)
1. **Clone the Repository**:
```
git clone [email protected]:dOrgTech/homebase-dao-deployer.git
cd homebase-dao-deployer
```

### Base URL: https://api.tzkt.io/
2. **Install Dependencies**:
```
yarn install
```

| Endpoint | URL | METHOD |
| ---------- | ---------------------------------- | ------ |
| Operations | /v1/accounts/${address}/operations | GET |
3. **Environment Setup**:
Create a `.env` file in the root directory and populate it with necessary environment variables as per the `.env.example` file.

## [Taquito Beacon Wallet](https://docs.walletbeacon.io/)
4. **Build the Project**:
```
yarn build
```

### Version: 13.0.1
5. **Run the Server**:
- For development:
```
yarn dev
```
- For production:
```
yarn start
```
# Using Homebase
## Future Development
## Creating a DAO
- **Code Refactoring**: Ongoing efforts to refactor code, incorporating learnings and best practices from the original Homebase app.
- **Feature Expansion**: Continuous development to introduce new features and enhance user experience.
1. Go to https://tezos-homebase.io/
2. Click on the `Create a DAO` button
### Contributing
If you're interested in contributing to the `homebase-dao-deployer`:
1. Fork the repository.
2. Create a new branch for your feature.
3. Make your changes.
4. Submit a pull request with a comprehensive description of the changes.
You will be taken to the DAO Creator, from which you will be asked to choose on the currently supported DAO templates.
## License
3. Select one of the supported DAO templates
4. Fill the DAO creation form. You will be asked to fill:

**DAO Settings**:

- DAO Name: this will also be the name of the DAO's token.
- Token Symbol
- Description

**Proposals and Voting**:

- **`Voting period duration`**
- **`Required stake to propose`**: required amount of DAO tokens to stake at the time of proposing. Currently follows the formula: `b + proposalSize`. Where:
- Proposal size is autocalculated based on the amount of transfers/registry updates (will get outdated soon on the contracts side)
- B is a constant amount of tokens
- **`Returned stake after proposal rejection`**
- **`Transfer amounts`** **(Treasury only)**: maximum and minimum amounts that can be transferred in a treasury proposal transfer. Currently only supports `XTZ`
- **`Quorum threshold`**: currently a natural number representing the total amount of votes required for a proposal to pass. Each token staked in a vote operation represents a vote. Therefore, with a quorum threshold of 500, a vote that stakes 500 tokens would make the proposal pass.
- **`Maximum proposal size`**

**Distribution Settings**:

- **`TokenHolders`**: initial token holder addresses and their initial balances. At least 1 is required.
- **`Administrator`**

5. You will then be taken to the review page. From here, click the `LAUNCH` button on the bottom right corner.
6. You will be redirected to the Launch screen. Do not close your browser tab until the whole process is complete (you are able to see and track progress by looking at the progress bar of this screen). You will be asked to connect your wallet if you haven't already, and then will be asked for 2 signatures: the first one originates the `Metadata Carrier` contract and the second one originates the actual `DAO contract`. When the originations are complete you will see a success message and a `Go to my DAO` button

## Exploring DAOs

Go to the home screen. From there you will see a list of all DAOs created in Homebase. They load in groups of 8 for load balancing (will be improved later on with indexer).
There is a searchbar available, however, note that searches done using this bar will only yield DAOs that have been already fetched, it will not trigger additional async requests.

Specific DAOs can be explored by clicking on them in the home screen or by URL:

`https://tezos-homebase.io/explorer/dao/${DAO_ADDRESS}`

## Managing a DAO

All DAOs, regardless of their template, have:

**DAO page**: contains all general DAO information. Here you can see:

- Current cycle
- Time left to vote
- DAO name and description
- DAO template type
- Token holders and their balances
- Active proposals
- Frozen tokens
- Voting addresses
- `Execute` button

**Proposals page**: contains all proposals related information and related actions. Here you can see:

- DAO name
- `New Proposal` button and creation modal
- `Execute` button
- Active proposals
- Frozen tokens
- Voting addresses
- Tables with all proposals, passed proposals and active proposals. Each proposal item contains:
- Title
- Hash
- Creation date and cycle
- Quorum reached vs quorum threshold
- For/Against votes vs total votes

**Proposal detail page**: contains all specific information about a proposal and vote actions. Here you can see:

- Breakdown of the proposal's details (transfers to execute, registry items to update, among others)
- Proposal title and description
- Status badge and history
- Quorum reached vs quorum threshold
- Proposer
- For and against votes, each with a detailed modal
- Vote for and against buttons and modals. Only enabled if proposal is active

**Proposal creation modal**: all proposal creation modals support multiple operations batched in the same proposal and also allow the user to batch upload transactions with a JSON file. This JSON should follow a specific signature, based on the template type of the DAO. See [proposal JSON signatures for each template](#dao-template-specific-pages-and-details)

### DAO Template specific pages and details:

Each DAO template has unique pages related to template specific actions. Also, the proposal creation modals are different across templates.

### **Registry**

**Registry** page: this page contains a table where all registry items can be visualized, and a table that contains a history of all proposals that updated the registry.
Each registry item can be clicked to get a read-only modal that displays the item's key and full value, additionally, clicking the settings icon in each row opens a modal to create a proposal to edit the clicked item. This page also contains a `New Item` button to create a proposal to add a new item.

**Proposal types**

There are 2 types of registry proposals:

- Edit proposals: used to edit one or several registry items
- Add proposals: used to add one or several items to the registry

At a contract level, there is no such distinction, but in the UI it exists to let the user create a new key or select a key from a dropdown of existing keys, depending on his intention.

**Proposal JSON signature**:

```json
{
"foo": "baz",
"bar": "qux",
...
}
```

### **Treasury**

**Holdings/Treasury** page: this page contains a table with all DAO holdings organized by token (currently, only supporting `XTZ`). And also contains a table with all outbound transfers made from the DAO.

**Proposal JSON signature**:

```json
[
{
"amount": 15,
"recipient": "tz1RKPcdraL3D3SQitGbvUZmBoqefepxRW1x"
},
{
"amount": 20,
"recipient": "tz1Zqb3hBBN8wLcJYhADcasi1jZdp2YLdG3L"
},
...
]
```

# Contributing

## Developer Docs

- [Tezos Homebase Docs](https://docs.google.com/document/d/1zZwcvX0jNE8PycOMNSULy2i-mcjg1LJ9FFYbGP4m9TM/edit?usp=sharing)
- [Tezos Homebase - Local Env Setup](https://docs.google.com/document/d/1GDnJzwezXXEGiwZAWioOlfvmcSuHuREpO7GIKMLjYmk/edit?usp=sharing)

## Running the project

To run the project:

- Make sure you have node installed
- `git clone [email protected]:dOrgTech/homebase-app.git`
- `cd homebase-app`
- `yarn`
- Create a `.env` file in the root, based on the `.env.example` provided in the code and ask one of the maintainers for the Pinata API Key
- `yarn dev`

# Glossary

- **Execute (Flush)**: execute all passed proposals from periods previous to the last one. If the proposal is rejected or did not meet the quorum threshold, then the Execute operation removes it from the proposals list.

- **Administrator**: address with permissions to mint, burn and transfer tokens in the DAO without a proposal. It is configured by the DAO creator and can be another contract (like a multisig)

- **Proposal size**: metric that describes the size, in packed bytes, of a proposal's metadata. Therefore, the bigger the proposal arguments are (more transfers or more registry updates), the bigger the proposal size is.
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"@airgap/beacon-types": "^4.1.0",
"@date-io/dayjs": "1.x",
"@taquito/beacon-wallet": "^17.0.0",
"@taquito/signer": "^17.0.0",
"@taquito/taquito": "^17.0.0",
Expand All @@ -25,12 +26,13 @@
"body-parser": "^1.20.2",
"connect-timeout": "^1.9.0",
"cors": "^2.8.5",
"dayjs": "^1.10.4",
"dayjs": "1.10.4",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"express-queue": "^0.0.13",
"graphql": "^15.5.1",
"graphql-request": "^3.4.0",
"node-fetch": "^3.3.2",
"node-fetch": "2",
"resolve-tspaths": "^0.8.17"
},
"devDependencies": {
Expand All @@ -51,11 +53,6 @@
"source-map-explorer": "2.5.2",
"typescript": "^5.0.4"
},
"eslintConfig": {
"extends": [
"react-app"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
Expand Down
12 changes: 0 additions & 12 deletions src/services/bakingBad/tokenBalances/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@ export interface NFTDTO {
standard: string
}

export interface BalanceTZKT {
id: number
account: Account
token: Token
balance: string
transfersCount: number
firstLevel: number
firstTime: string
lastLevel: number
lastTime: string
}

export interface Account {
alias: string
address: string
Expand Down
2 changes: 1 addition & 1 deletion src/services/config/env.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EnvKey } from "./constants"
require("dotenv").config()
import "dotenv/config"

export const getEnv = (envKey: EnvKey): string => {
return process.env[envKey] ?? ""
Expand Down
3 changes: 1 addition & 2 deletions src/services/contracts/baseDAO/lambdaDAO/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Expr, Parser, unpackDataBytes, MichelsonData, MichelsonType, packDataBytes } from "@taquito/michel-codec"
import { TezosToolkit } from "@taquito/taquito"
import { Schema } from "@taquito/michelson-encoder"
import { BaseDAO, BaseDAOData, getContract } from ".."
import { BaseDAO, BaseDAOData, getContract } from "services/contracts/baseDAO"
import { RegistryProposeArgs } from "./types"
import { bytes2Char, char2Bytes } from "@taquito/tzip16"
import proposeCode from "./michelson/propose"
import proposelambda from "./michelson/proposelambda"
import { LambdaExtraDTO, RegistryExtraDTO } from "services/services/types"
import { mapTransfersArgs } from "services/services/dao/mappers/proposal"
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"compilerOptions": {
"module": "commonjs",
"baseUrl": "src",
"jsx": "react-jsx",
"esModuleInterop": true,
"resolveJsonModule": true,
"skipLibCheck": true,
Expand Down
Loading

0 comments on commit dbb9827

Please sign in to comment.