Olive is a Next.js monorepo project that implements Dollar Cost Averaging using the CoW Protocol.
Before you can run this project, make sure you have the following software installed:
- Node.js 22+ 🟢
- Yarn 🧶
- Git 🐙
-
Clone the repository with submodules:
git clone --recurse-submodules https://github.com/folktizen/olive.git
If you already cloned without
--recurse-submodules, run:git submodule update --init --recursive
-
Install the dependencies:
cd olive yarn install -
Start the development server:
yarn dev
The dev server will start at http://localhost:3000 🌐
Note: The files
bin/build-subgraph.tsandbin/config.tsreferenced in previous instructions do not exist. Please refer to the scripts inpackages/subgraph/package.jsonfor subgraph build and deployment steps.
-
To deploy the Subgraph, use the appropriate
build:<network>anddeploy:<network>scripts inpackages/subgraph/package.json.cd packages/subgraph yarn build:ethereum yarn deploy:ethereum
To deploy Olive to production:
yarn build- Update the SDK:
- Add smart contract addresses for the target chain:
- Olive TradeFoundry
- Olive DCAFarm singleton
- Olive TheGraph subgraph endpoint
- CoW Protocol's settlement address
- Update
packages/sdk/src/vaults/constants.ts - Run:
cd packages/sdk yarn typechain yarn build
- Add smart contract addresses for the target chain:
- Update the Subgraph:
- Edit the relevant config and network support in
packages/subgraphscripts and config files.
- Edit the relevant config and network support in
- Update the UI web:
- Add tokens and default pairs in the appropriate files under
packages/web/models/,packages/web/utils/, or related directories as your project structure requires. - Update WAGMI chains config and token picker constants in their respective files.
- Add tokens and default pairs in the appropriate files under
- Try to create a new farm in the UI!
React Context checks values using simple equality (==).
Tip: Always use the
useMemo()hook for custom Contexts to avoid unnecessary re-renders, especially when wrapping the whole app.
- Example files:
packages/web/context/ - More info: React Context Docs
-
Unhandled Runtime Error (Next.js):
- On Next.js v13.2.4+, exporting a client component with a normal function can cause this. Use an arrow function instead.
-
Warning: Extra attributes from the server:
- Caused by browser extensions (e.g., Grammarly, LanguageTool) injecting attributes. Disable/configure extensions for dev ports (like
3000).
- Caused by browser extensions (e.g., Grammarly, LanguageTool) injecting attributes. Disable/configure extensions for dev ports (like
-
Cannot read properties of undefined (reading Component):
- Likely due to circular dependencies. Check for import cycles and adjust exports (see
packages/web/components/index.ts).
- Likely due to circular dependencies. Check for import cycles and adjust exports (see
-
Error fetching
generated/contracts:- App build failure. Try:
rm -rf node_modules yarn install yarn build:web yarn dev
- App build failure. Try:
We welcome contributions! To get started:
-
Fork this repo 🍴
-
Create a new branch for your changes 🌱
-
Make your changes and ensure your code passes formatting and typechecking:
yarn format yarn typecheck
-
Submit a pull request 🚀
Olive is released into the public domain under the MIT. Enjoy! 🎉
- Formatting:
- Run
yarn formatin the root or any package to format code using Prettier. - Each package can have its own
.prettierignorefor custom ignore rules. - Prettier config is shared via
@useolive/config.
- Run
- Linting:
- ESLint is not used in this monorepo. All linting is handled by Prettier formatting rules.
- If you need linting, add ESLint config to the relevant package.