Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contributing draft #420

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions CONTRIBUTING.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Contributing

Thank you for considering contributing to the DAOHaus Protocol. We welcome any contributions that can help improve the project, including bug reports, feature requests, and code changes.

## Getting Started

Contributions are made to this repo via Issues and Pull Requests (PRs).

### Issues

- [Monorepo Issues](https://github.com/HausDAO/monorepo/issues)
- [DAO app starter](https://github.com/HausDAO/dao-app-starter-vite/issues)
- Contract repos
- [Baal Contracts](https://github.com/HausDAO/Baal/issues)
- [Shamans](https://github.com/HausDAO/baal-shamans/issues)
- [Baal Tokens](https://github.com/HausDAO/baal-tokens/issues)

Issues should be used to report problems with the library, request a new feature, or to discuss potential changes before a PR is created. When you create a new Issue, a template will be loaded that will guide you through collecting and providing the information we need to investigate.

If you find an issue you want to work on follow the Pull Request instructions!

### Pull Requests

In general, PRs should:

- Address a single concern in the least number of changed lines as possible.
- Include documentation in the repo or on our [docs site](https://docs.daohaus.club/) if applicable.
- Be accompanied by a complete Pull Request template (loaded automatically when a PR is created).

In general, we follow the ["fork-and-pull" Git workflow](https://github.com/susam/gitpr)

1. Fork the repository to your own Github account
2. Clone the project to your machine
3. Create a branch locally with a succinct but descriptive name
4. Commit changes to the branch
5. Push changes to your fork
6. Open a PR in our repository and follow the PR template so that we can efficiently review the changes.

### Local Development

Our monorepos use [Nx](https://nx.dev/) as a build system and for scaffolding. If this your first time using Nx, you'll have to install it globally on your system:
`npm install -g nx`

Here is a basic guide. Each package README (and `project.json`) will have more details about commands within each package.

#### Clone and install

```bash
`git clone [email protected]:HausDAO/daohaus-monorepo.git` or `[email protected]:HausDAO/daohaus-monorepo.git`
# clone the entire monorepo at the top level on the develop branch
`nvm use`
# switch to node 16.16.0
`yarn global add nx`
# download nx globally for running nx commands
`yarn`
# run yarn to install all of the packages and dependencies
```

#### Set up .env

```bash
cp .env.sample .env
```

Rivet is the default RPC - Get a free Rivet key [here](https://rivet.cloud/)

```yaml
NX_RIVET_KEY
```

You can also use Alchemy API keys for Optimism, Arbitrum or Polygon

```yaml
NX_OPTIMISM_ALCHEMY_KEY
NX_ARBITRUM_ALCHEMY_KEY
NX_POLYGONPOS_ALCHEMY_KEY
```

Proposal details uses etherscan explorer APIs to fetch ABIs. Add a key for any chain you are supporting. Get an Etherscan API key [here](https://etherscan.io/apis)

```yaml
NX_ETHERSCAN_KEY
NX_ARBISCAN_KEY
NX_GNOSISSCAN_KEY
NX_POLYGONSCAN_KEY
NX_OPTIMISMSCAN_KEY
```

If developing for Mainnet or Gnosis Chain you can get an API key [here](https://thegraph.com/explorer/subgraph?id=GfHFdFmiSwW1PKtnDhhcxhArwtTjVuMnXxQ5XcETF1bP&view=Overview). Ignore this one if not worried about mainnet or gnosis chain yet.

```yaml
NX_GRAPH_API_KEY_MAINNET
```

#### Run the apps

Once cloned and everything is installed, you'll be able to run each package! Package-level commands are run with `nx run` instead of `yarn` -- this may be new if you're used to working in a different monorepo structure. Each package has similar command structure, but some packages have additional commands.

The package-level commands can be found in each package `project.json`.

```bash

# run a specific package locally (usually on localhost:3000)
# such as the component library or frontend applications

nx run app-name:serve

# example to run the Admin app:

nx run admin:serve

# lint a specific package

nx run app-name:lint

# example to lint the Hub app:

nx run hub-app:lint

# build a specific package:

nx run app-name:build

# example to build the Summon app:

nx run summon:build
```

## Getting Help

Join us in the [DAOHaus Discord](https://discord.com/invite/3drjHWWcRa) and post your question #support channel.
36 changes: 6 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DAOhaus v3 Monorepo

DAOhaus is a no-code platform for summoning and managing Moloch DAOs. We've worked to reimagine our platform into multiple apps, libraries, and microservices. We're using a monorepo to streamline the development of all of these elements, and we used [Nx](https://nx.dev) to scaffold our monorepo.
DAOhaus is a platform for summoning and managing Moloch DAOs. We've worked to reimagine our platform into multiple apps, libraries, and microservices. We're using a monorepo to streamline the development of all of these elements, and we used [Nx](https://nx.dev) to scaffold our monorepo.

If you'd like to join our community, we coordinate on [Discord](https://discord.gg/gWH4vt3tWE).

Expand All @@ -19,40 +19,16 @@ Our applications in the `apps` folder are our DAO infrastructure and leverage ou
- **User Interfaces**: These are our applications that are used to interact with DAOs.
- Admin App
- Summoner App
- **Deployed Infrastructure**: These are our jobs and subgraphs and are deployed to provide functionality leveraged throughout our other applications.
- v3 Subgraph

| App | Build | Entry Points |
| ---------------------------------- | ----------- | ------------------ |
| [Admin App](./apps/admin) | webpack, ts | `apps/admin` |
| [Summoner App](./apps/summon/) | webpack, ts | `apps/summon` |
| [v3 Subgraph](./apps/v3-subgraph/) | webpack, ts | `apps/v3-subgraph` |
**v3 Subgraph**

### Libs

Our libraries in the `libs` folder are structured to be consumed by our apps as well as used by external developers using our tooling. Currently, we have three categories of libraries:

- **Utility Libraries**: These are libraries that are used to provide foundational utility that can be composed and integrated into applications.
- Utilities libraries
- Data reading libraries
- Date writing libraries (contract function wrappers)
- Component Library
- **Feature Libraries**: These compose together other libraries such as the _DAO Data SDK_ and the _Component Library_ to create "smart components" that can be integrated into applications.
- DAOhaus Connect
- Tx Builder
- Form Builder
- React application data context

| Lib | Entry Point |
| -------------------------------------------- | ------------------------- |
| [ABI Utilities](./libs/abis/) | `libs/abis` |
| [Contract Utilities](./libs/contract-utils/) | `libs/contract-utils` |
| [Common Utilities](./libs/utils/) | `libs/utils` |
| [DAO Data SDK](./libs/moloch-v3-data) | `libs/moloch-v3-data-sdk` |
| [Component Library (UI)](./libs/ui) | `libs/ui` |
| [DAOhaus Connect](./libs/connect) | `libs/connect` |
| [Tx Builder](./libs/tx-builder) | `libs/tx-builder` |
| [Form Builder](./libs/form-builder) | `libs/form-builder` |
- **Utility Libraries**: The utilities packages contain a host of common functions, constants, and helper utilities that are routinely used across our other libraries.
- **Data Libraries**: The data packages wrap our contracts, subgraphs and other data sources. They help with fetching dao data, profile data and writing to contracts.
- **UI Component Library**: The DAOhaus UI package is a comprehensive library, offering a robust set of UI components. You can import and use these to construct your application’s user interface. The package caters particularly to TypeScript app development and can be adapted to any framework.
- **Feature Libraries**: These features are a powerful blend of UI and data elements, crafted with the intention to provide you with robust, ready-to-use components that seamlessly integrate with your applications.

## Getting Started

Expand Down
12 changes: 8 additions & 4 deletions libs/abis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@

This library was generated with [Nx](https://nx.dev).

## Getting Started
### [View on NPM](https://www.npmjs.com/package/@daohaus/abis)

**Install**
## Usage

### Installation

```sh
yarn add @daohaus/abis
```

**Get ABI Instances**
### Examples

**How to get ABI instances**

```ts
import { LOCAL_ABI } from '@daohaus/abis';
Expand All @@ -24,4 +28,4 @@ console.log(summonerContractAbi);

## Building

Run `nx build abis` to build the library.
Run `nx run abis:build` to build the library.
18 changes: 14 additions & 4 deletions libs/connect-context/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# connect-context
# @daohaus/connect-context

This library was generated with [Nx](https://nx.dev).
**DAOhaus Connect Context** is a base package for `@daohaus/connect` and will rarely be used without that package. It provides the core functionality while the connect package provides the UI features.

## Running unit tests
### [View on NPM](https://www.npmjs.com/package/@daohaus/connect-context)

Run `nx test connect-context` to execute the unit tests via [Jest](https://jestjs.io).
## Usage

### Installation

```bash
yarn add @daohaus/connect-context
```

## Building

Run `nx run connect-context:build` to build the library.
82 changes: 48 additions & 34 deletions libs/connect/README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,90 @@
# `@daohaus/connect`
# @daohaus/connect

**DAOhaus Connect** provides a drop-in component for handling wallet connection, and includes additional functionality such as notifying users of unsupported networks, switching networks, and displaying ens data and [Lens profile data](https://www.lens.xyz/) data if the user has one set.
**DAOhaus Connect** provides a drop-in component for handling wallet connection. It includes additional functionality such as notifying users of unsupported networks, switching networks, and displaying ens data. It also includes a top-of-page navigation component and a layout component to enable rapid application development. It is opinionated and composed with the following libraries:

This is used throughout our applications and is designed to be leveraged by the larger DAOhaus community as a portal into the DAOhaus ecosystem.
- [Web3 Modal and Wallet Connect](https://web3modal.com/)
- [React-Router](https://reactrouter.com/en/main)

This library was generated with [Nx](https://nx.dev).
### [View on NPM](https://www.npmjs.com/package/@daohaus/connect)

## Getting Started
## Usage

**Install**
### Installation

```sh
```bash
yarn add @daohaus/connect
```

### DHConnectProvider Context Provider
Note: This will also install @daohaus/connect-context

Start by importing the `DHConnectProvider` component from the `@daohaus/connect` package at your app's root component, such as `main.tsx`:
### Requirements

```jsx
// main.tsx
You will need to provide a Wallet Connect V2 api key as an env variable at NX_WALLET_CONNECT_ID. You can get those from [Wallet Connect](https://docs.walletconnect.com/2.0/api/auth/overview#key-features)

import { DHConnectProvider } from '@daohaus/daohaus-connect-feature';
```
NX_WALLET_CONNECT_ID=<some wc api key>
```

### Examples

Once imported you can use it as you would any other Context Provider:
**How to add to your application**

```jsx
// main.tsx
import { DHConnectProvider } from `@daohaus/connect`;

ReactDOM.render(
<StrictMode>
<BrowserRouter>
<DHConnectProvider>
<DHConnectProvider
daoId={"some dao id if scoping to a single dao"}
daoChain={"some dao chain id if scoping to single chain"}>
<App />
</DHConnectProvider>
</BrowserRouter>
</StrictMode>,
document.getElementById('root')
);
```

After including the `<DHConnectProvider/>` component in your app, you'll be able to access the associated Context throughout your app.
document.getElementById('root')

### Connecting to a Wallet
```

DAOhaus Connect exposes several useful tools that can be used throughout your app. You can access these by importing `useDHConnect` from DAOhas Connect:
**How to add the DAOHaus layout and nav**

```jsx
import { useDHConnect } from '@daohaus/daohaus-connect-feature';
import { HausLayout } from '@daohaus/daohaus-connect-feature'

<HausLayout
pathname={location.pathname}
navLinks={[{ label: 'Home', href: '/'` }]}
footer={<Footer />}
>
<YourApp /> // any other components that are needed
</HausLayout>
```

Once this is imported, you can destructure out useful tools, such as `connectWallet`:
**How to make a connect button**

```jsx
const { connectWallet } = useDHConnect();
const { connectWallet } = useConnect();

<Button onClick={connectWallet} sm type="button">
Connect
</Button>;
```

This can then be passed into any Button with an `onClick` handler:
**How to get connected wallet data**

```jsx
<Button onClick={connectWallet} size="sm" type="button">
Connect
</Button>
```
const { isConnected, address } = useConnect();

There are other useful tools such as interacting with Ceramic that we'll continue to add to the documentation.
...

## Examples
if (!isConnected) {
return <ConnectWalletButton isSm={isSm} />;
}

We use DAOhaus Connect in both our Admin and Summon apps.
return <p>{address}</p>;
};
```

## Building

Run `nx build connect` to build the library.
Run `nx run connect:build` to build the library.
Loading
Loading