This is the front-end repo for Olympus that allows users to be part of the future of Meta Greece.
We are moving at web3 speed and we are looking for talented contributors to boost this rocket. Take a look at our CONTRIBUTING GUIDE if you are considering joining a world class DAO.
_ Note We're currently in the process of switching to TypeScript. Please read this guide on how to use TypeScript for this repository. https://github.com/OlympusDAO/olympus-frontend/wiki/TypeScript-Refactor-General-Guidelines _
Required:
$ git clone https://github.com/OlympusDAO/olympus-frontend.git
$ cd olympus-frontend
# set up your environment variables
# read the comments in the .env files for what is required/optional
$ cp .env.example .env
# fill in your own values in .env, then =>
$ yarn
$ yarn start
The site is now running at http://localhost:3000
!
Open the source code and start editing!
If you would like to run the frontend in a Docker image (e.g. to isolate dependencies and the nodejs version), run yarn docker-start
.
Unit tests are co-located with source code with naming convention *.unit.test.js
.
Jest is the test driver. Unit tests are isolated from integration dependencies via mocks; including Web3 RPC APIs and smart contract interactions.
No local blockchain node is expected to run for unit testing. Hard Hat is not required.
To run all unit test and see coverage report:
yarn test:unit
Rinkeby faucet for sOHM:
Lives here, to retrieve test sOHM click Connect to Web3
and use function #3: dripSOHM
. After connecting to web3, click Write
to execute and 10 sOHM will automatically be transferred to your connected wallet.
Note: The faucet is limited to one transfer per wallet every 6500 blocks (~1 day)
Puppeteer (with the Dappeteer addition) is used to do browser-based end-to-end testing.
To run the tests:
- Run the frontend, using
yarn start
- In another terminal, run the tests, using
yarn test:e2e
Rinkeby faucet for WETH: Wrap rinkeby eth on rinkeby uniswap
Rinkeby faucets for LUSD, FRAX & DAI can be taken from rinkeby etherscan:
- Go to
src/helpers/AllBonds.ts
- Then copy the rinkeby
reserveAddress
for the applicable bond & navigate to that contract on rinkeby etherscan. - On Rinkeby etherscan use the
mint
function. You can use the number helper for 10^18 & then add four more zeros for 10,000 units of whichever reserve you are minting.
The app is written in React using Redux as the state container.
The files/folder structure are a WIP and may contain some unused files. The project is rapidly evolving so please update this section if you see it is inaccurate!
./src/
├── App.jsx // Main app page
├── abi/ // Contract ABIs from etherscan.io
├── actions/ // Redux actions
├── assets/ // Static assets (SVGs)
├── components/ // Reusable individual components
├── constants.js/ // Mainnet Addresses & common ABI
├── contracts/ // TODO: The contracts be here as submodules
├── helpers/ // Helper methods to use in the app
├── hooks/ // Shared reactHooks
├── themes/ // Style sheets for dark vs light theme
└── views/ // Individual Views
Themes are available, but it can be difficult to access the theme's colors.
Material UI components, such as Button
, can use the current theme's color scheme through the color
property. For example:
<Button variant="contained" color="primary" className="cause-give-button">
Give Yield
</Button>
If you wish to use a theme's color scheme manually, follow these steps:
- Import
useTheme
:import { useTheme } from "@material-ui/core/styles";
- Instantiate the theme:
const theme = useTheme();
- Add a style property to the component, for example:
<Grid item className="cause-category" style={{ backgroundColor: theme.palette.background.default }}>
{category}
</Grid>
For the available theme properties, take a look at the themes in src/themes
.
Olympus uses linguijs to manage translation.
The language files are located in a submodule deployed in src/locales/translations
. This submodule points to the olympus translation repository
In order to mark text for translation you can use:
- The component in jsx templates eg.
<Trans>Translate me!</Trans>
- The t function in javascript code and jsx templates.
t`Translate me`
You can also add comments for the translators. eg.
t({
id: "do_bond",
comment: "The action of bonding (verb)",
})
When new texts are created or existing texts are modified in the application please leave a message in the OlympusDao app-translation channel for the translators to translate them.
$ git diff
# shows two commits in conflict below (fbdd867,e6e0919)
diff --cc src/locales/translations
index fbdd867,e6e0919..0000000
--- a/src/locales/translations
+++ b/src/locales/translations
cd src/locales/translations
# first commit
git checkout fbdd867
# merge in second commit
git merge e6e0919
git commit
cd ../../..
git add src/locales/translations
git commit
Auto deployed on Fleek.co fronted by Cloudflare. Since it is hosted via IPFS there is no running "server" component and we don't have server sided business logic. Users are served an index.html
and javascript to run our applications.
TODO: TheGraph implementation/how/why we use it.
Commits to the follow branches are automatically deployed to their respective URLs.
Branch | URL |
---|---|
master | https://app.olympusdao.finance |
deploy | https://staging.olympusdao.finance |
Pull Requests: Each PR into master will get its own custom URL that is visible on the PR page. QA & validate changes on that URL before merging into the deploy branch.
- Give: by default it is enabled. It can be disabled by setting the
REACT_APP_GIVE_ENABLED
environment variable to "false".
First, take a look at our CONTRIBUTING GUIDE .
We keep an updated list of bugs/feature requests in Github Issues.
Filter by "good first issue" to get your feet wet! Once you submit a PR, our CI will generate a temporary testing URL where you can validate your changes. Tag any of the gatekeepers on the review to merge them into master.
NOTE: For big changes associated with feature releases/milestones, they will be merged onto the develop
branch for more thorough QA before a final merge to master
Defenders of the code:
Only the following people have merge access for the master branch.
- Join our Discord and ask how you can get involved with the DAO!