Skip to content

Commit

Permalink
[LocalEnv] Fix docs, add localenv client env template
Browse files Browse the repository at this point in the history
  • Loading branch information
mslomnicki committed Mar 20, 2024
1 parent 3e075ac commit 2150e09
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 20 deletions.
59 changes: 52 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,51 @@

Octant is a community-driven platform for experiments in decentralized governance.

Developed by the [Golem Foundation](https://golem.foundation/) to test various hypotheses around user control, voter engagement, and community funding, the platform allows for running various governance experiments in a real-life environment and rewards user participation with ETH.
Developed by the [Golem Foundation](https://golem.foundation/) to test various hypotheses around
user control, voter engagement, and community funding, the platform allows for running various
governance experiments in a real-life environment and rewards user participation with ETH.

Documentation is available [here](https://docs.octant.app/).

---

## Runing development environment

Below is development setup instructions. More documentation, configuration, deployment information is available in directories of this repository.
Below is development setup instructions. More documentation, configuration, deployment information
is available in directories of this repository.

For the first build of contracts it is highly recommended to run the following command first (this
step will require
having [configured gcloud docker authentication](#gcloud-docker-images-repository-authentication) or
[local build of anvil's fork](#local-build-of-patched-anvil)):

For the first build of contracts it is highly recommended to run the following command first (this step will require having configured gcloud docker authentication):
```bash
yarn localenv:build-anvil
```

Build images with the following command:

```bash
yarn localenv:build-images
````

Run local environment

```sh
yarn localenv:up
```

To stop the environment, simply, run:

```sh
yarn localenv:down
```

Local environemnt is available at [http://octant.localhost:8080](http://octant.localhost:8080) and at [http://localhost:8080](http://localhost:8080).
Local environemnt is available at [http://octant.localhost:8080](http://octant.localhost:8080) and
at [http://localhost:8080](http://localhost:8080).

*NOTICE:* in order to make it work using octant.localhost domain one should add the following lines to `/ect/hosts` file.
*NOTICE:* in order to make it work using octant.localhost domain one should add the following lines
to `/ect/hosts` or `C:\Windows\system32\drivers\etc\hosts` file.

```
127.0.0.1 octant.localhost
Expand All @@ -43,15 +56,47 @@ Local environemnt is available at [http://octant.localhost:8080](http://octant.l
127.0.0.1 client.octant.localhost
```
### Starting web client
Full web client documentation is available [here](client/README.md).
- go to `client` directory
- copy `.env.localenv-template` to `.env`
- Run client `yarn dev`
- Go to [client webpage](http://octant.localhost:5173)
**TL;DR version:**
```shell
cd client
cp .env.localenv-template .env
yarn dev
```

## gcloud docker images repository authentication

Please notice, that for the time being, we are using our own fork of `foundry` (especially `anvil`), and we have a pre-built image stored at Google Cloud.
Please notice, that for the time being, we are using our own fork of `foundry` (especially `anvil`),
and we have a pre-built image stored at Google Cloud.
In order to configure access to this image one should have `gcloud` configured and then run command:

`$ gcloud auth configure-docker europe-docker.pkg.dev`

## Local build of patched anvil

If you don't have access to Golem Foundation image repository you can build image yourself from
branch `foundry-4129/trace-filter-support` of our `foundry` fork.

```shell
git clone https://github.com/golemfoundation/foundry.git --branch=foundry-4129/trace-filter-support --single-branch
cd foundry
docker build -t europe-docker.pkg.dev/wildland-dev/octant-test/foundry:latest .
```

---

## Contributor Agreement

In order to be able to contribute to any Wildland repository, you will need to agree to the terms of the [Wildland Contributor Agreement](https://docs.wildland.io/contributor-agreement.html). By contributing to any such repository, you agree that your contributions will be licensed under the [GPLv3 License](https://gitlab.com/wildland/governance/octant/-/blob/master/LICENSE).
In order to be able to contribute to any Wildland repository, you will need to agree to the terms of
the [Wildland Contributor Agreement](https://docs.wildland.io/contributor-agreement.html). By
contributing to any such repository, you agree that your contributions will be licensed under
the [GPLv3 License](https://gitlab.com/wildland/governance/octant/-/blob/master/LICENSE).
18 changes: 18 additions & 0 deletions client/.env.localenv-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
SECRET_WORDS=test test test test test test test test test test test junk
VITE_CRYPTO_VALUES_ENDPOINT=https://cps.mainnet.octant.app/
VITE_IPFS_GATEWAYS=https://turquoise-accused-gayal-88.mypinata.cloud/ipfs/,https://octant.infura-ipfs.io/ipfs/
VITE_WALLET_CONNECT_PROJECT_ID=588213fd06714cc7e36ecbc5f2fdfd21
VITE_NETWORK=Local
VITE_SERVER_ENDPOINT=http://backend.octant.localhost:8080/
VITE_WEBSOCKET_ENDPOINT=http://localhost:5010
VITE_SUBGRAPH_ADDRESS=http://graph.octant.localhost:8080/subgraphs/name/octant
VITE_JSON_RPC_ENDPOINT=http://rpc.octant.localhost:8080
VITE_ARE_CURRENT_EPOCHS_PROJECTS_HIDDEN_OUTSIDE_ALLOCATION_WINDOW=false
VITE_ALCHEMY_ID=TO_BE_REMOVED

# Paste here values from "Local Contracts" section of localenv
VITE_GLM_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
VITE_DEPOSITS_ADDRESS=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9
VITE_EPOCHS_ADDRESS=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
VITE_PROPOSALS_ADDRESS=0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9
VITE_VAULT_ADDRESS=0xa513E6E4b8f2a923D98304ec87F64353C4D5C853
30 changes: 17 additions & 13 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,30 @@ Use only node:16 because of [problem](https://github.com/Synthetixio/synpress/is

Ensure that the `.env` file is present. See `.env.template`.

### Envs
### Environment envs

1. `VITE_NETWORK` sets network used by the application. Supported values are 'Local', 'Mainnet', 'Sepolia'. Whenever different value is set, app uses 'Sepolia' network config.
2. `VITE_JSON_RPC_ENDPOINT`: when provided, app uses first JSON RPC provided with this endpint. When it's not provided, app uses alchemy provider first.
3. `VITE_ARE_CURRENT_EPOCHS_PROJECTS_HIDDEN_OUTSIDE_ALLOCATION_WINDOW` when set to 'true' makes current epoch's projects hidden when allocation window is closed.
4. `VITE_IPFS_GATEWAYS` is an array of URLs separated by strings sorted by priority with providers the app should try to fetch the data about projects from. When fetching from the last fails client shows error toast message. Each URL should end with a forward slash (`/`).
- `VITE_NETWORK` sets network used by the application. Supported values are 'Local', 'Mainnet', 'Sepolia'. Whenever different value is set, app uses 'Sepolia' network config.
- `VITE_JSON_RPC_ENDPOINT`: when provided, app uses first JSON RPC provided with this endpoint. When it's not provided, app uses alchemy provider first.
- `VITE_ALCHEMY_ID`: Alchemy API key
- `VITE_ARE_CURRENT_EPOCHS_PROJECTS_HIDDEN_OUTSIDE_ALLOCATION_WINDOW` when set to 'true' makes current epoch's projects hidden when allocation window is closed.
- `VITE_IPFS_GATEWAYS` is an array of URLs separated by strings sorted by priority with providers the app should try to fetch the data about projects from. When fetching from the last fails client shows error toast message. Each URL should end with a forward slash (`/`).
- `VITE_SERVER_ENDPOINT`: URL of backend server. URL should end with a forward slash (`/`).

`yanr generate-abi-typings` is used to generate typings for proposals ABIs that we have in codebase. In these typings custom adjustments are added, e.g. in some places `string` is wrongly instead of `BigInt`. Linter is also disabled there. Since ABIs do not change, this command doesn't need to rerun.
`yarn generate-abi-typings` is used to generate typings for proposals ABIs that we have in codebase. In these typings custom adjustments are added, e.g. in some places `string` is wrongly instead of `BigInt`. Linter is also disabled there. Since ABIs do not change, this command doesn't need to rerun.

### Contracts
### Contract envs

Client uses 5 contracts. Following are their names and envs which should have their addresses:

1. Deposits (`VITE_DEPOSITS_ADDRESS`).
2. Epochs (`VITE_EPOCHS_ADDRESS`).
3. ERC20 (`VITE_GLM_ADDRESS`).
4. Proposals (`VITE_PROPOSALS_ADDRESS)`.
5. Vault (`VITE_VAULT_ADDRESS`).
- Deposits (`VITE_DEPOSITS_ADDRESS`)
- Epochs (`VITE_EPOCHS_ADDRESS`)
- ERC20 (`VITE_GLM_ADDRESS`)
- Proposals (`VITE_PROPOSALS_ADDRESS)`
- Vault (`VITE_VAULT_ADDRESS`)

Values for all but `VITE_JSON_RPC_ENDPOINT` envs are required. In order to deploy client without Epochs & Vault contracts please use any placeholder value for their envs (e.g. `placeholder`), i.e. `VITE_EPOCHS_ADDRESS=placeholder`.
Values for all but `VITE_JSON_RPC_ENDPOINT` envs are required.

In order to deploy client without Epochs & Vault contracts please use any placeholder value for their envs (e.g. `placeholder`), i.e. `VITE_EPOCHS_ADDRESS=placeholder`.

## Proposals

Expand Down

0 comments on commit 2150e09

Please sign in to comment.