Skip to content
5 changes: 1 addition & 4 deletions .github/ISSUE_TEMPLATE/bug-report---.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
---
name: "Bug report \U0001F41B"
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

labels: 'new issue, bug'
---

**Describe the bug**
Expand Down
5 changes: 1 addition & 4 deletions .github/ISSUE_TEMPLATE/feature-request---.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
---
name: "Feature request \U0001F47B"
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

labels: 'new issue, feature'
---

**Is your feature request related to a problem? Please describe.**
Expand Down
28 changes: 28 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## General Changes

- Fixes XYZ bug
- Adds XYZ feature
- …

## Developer Notes

Add any notes here that may be helpful for reviewers.

## Author Checklist

- [ ] The base branch is set to `main`
- [ ] The title is using [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) formatting
- [ ] The Github issue has been linked to the PR in the Development section
- [ ] The General Changes section has been filled out
- [ ] Developer Notes have been added (optional)

## Reviewer Checklist

- [ ] End-to-end tests are passing without any errors
- [ ] Code style generally follows existing patterns
- [ ] Code changes do not significantly increase the application bundle size
- [ ] New third-party packages, if any, do not introduce potential security threats
- [ ] There are no CI changes, or they have been OK’d by the devops team
- [ ] Code changes have been quality checked in the ephemeral URL
- [ ] There are two or more approvals from the core team
- [ ] Squash and merge has been checked
155 changes: 101 additions & 54 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,109 +1,156 @@
# Contributing

## Initial setup
We use Github issues for tracking new features, bug fixes, and enhancements related to the Aave Interface. We are currently working on a UI/UX Integrations framework for integrating third-party services and entities within the Aave Interface. Please stay tuned for new information around this.

```sh
# potentially you can user other node versions, but it's only tested on what's currently listed in nvmrc
## Pre-Requisites

### Install Node

We are using a Next.js application, which relies on Node. You must have Node installed and set to use the specified version in `.nvmrc`. You can potentially use other versions, but we don’t recommend differing here.

You can download from the [NodeJS website](https://nodejs.org/en/download/), but we recommend installing nvm and running the following command at root, after cloning or downloading the repo.

```bash
nvm use
```

### Install Dependencies

Download [Yarn Package Manager](https://yarnpkg.com/) and install the dependencies.

```bash
yarn install
```

### Setup Environment Variables

There are a few environment variables that we store for the interface. Before starting development, copy over the environment variables from the provided dummy file to a local copy.

```bash
cp .env.example .env.local
```

## Running the interface
## Get Up & Running Locally

Once you’ve completed the pre-requisites above, you should be able to start running the interface locally. There are several variations of running locally.

```sh
### Development Mode

Development builds are run with a watcher and an open server listening on `localhost:3000`.

```bash
yarn dev
```

## Build
### Production Mode

```sh
# builds the app for usage on serverless & containered hosting platforms like vercel
Production-based builds are great for usage on serverless & container-based hosting platforms like [Vercel](https://vercel.com) or [Heroku](https://heroku.com). To compile the source files into minified, production-ready asset bundles, run the build command.

```bash
yarn build
# builds the app as a static bundle to be hosted on ipfs
yarn build:static
```

### Environment
There is also the option to build the application for usages as a static site on platforms like IPFS, AWS, Vercel, etc. This essentially builds the application as above and additionally uses the `next export` command. More information around Next’s export command can be found [here](https://nextjs.org/docs/advanced-features/static-html-export).

```sh
# setting the environment to 'staging' will enable testnet markets, disabling governance, staking, and production markets
NEXT_PUBLIC_ENV=prod
# you can also disable staking & governance by altering
NEXT_PUBLIC_ENABLE_GOVERNANCE=true
NEXT_PUBLIC_ENABLE_STAKING=true
```bash
yarn build:static
```

## Test
To start the server in production mode and use these bundled, minified assets, run the following command. This will start the web server listening on `localhost:3000`.

The integration test suite runs against tenderly forks of various networks. To setup the local environment you need to add environment variables accordingly:

```sh
TENDERLY_KEY=<api key>
TENDERLY_ACCOUNT=<account name>
TENDERLY_PROJECT=<project name>
```bash
yarn start
```

For setup env with staking page (to get positive result for staking test coverage), need to execute:
You can also serve up the static site assets with the following command, which can be viewable on `localhost:3000`.

```bash
yarn serve:static
```
cp .env.example .env.local

### Test Mode

The integration test suite runs against [Tenderly](https://tenderly.co/) forks of various networks. To setup the local environment, you’ll first need to create an account and obtain an access key. Then fill in the three environment variables accordingly:

```bash
TENDERLY_KEY=<your access key>
TENDERLY_ACCOUNT=<your account/organization name>
TENDERLY_PROJECT=<your project name>
```

For running the integration test suite you need to run the app. You can either run again `yarn dev` which will be a bit more resource intensive as the app will be build on the fly or run against a static build via `yarn build:static` & `yarn serve:static`.
For running the integration test suite, you’ll need to have the application running locally in a separate terminal. You may choose to either run it in development mode via `yarn dev` or against a static production build via `yarn build:static` & `yarn serve:static`. The caveat to running in development mode is that it will be more resource-intensive, since the application will be built on the fly.

```sh
```bash
# open interactive cypress test suite
yarn test:open

# run all tests in headless mode
yarn test:headless
```

## Run on a fork
## Environment Variables

Some environment variables can be adjusted to suite your needs during development, depending on the scenarios you want to test or build in.

```bash
# setting the environment to 'staging' will enable testnet markets, disabling governance, staking, and production markets
NEXT_PUBLIC_ENV=prod

# you can also disable staking & governance by altering
NEXT_PUBLIC_ENABLE_GOVERNANCE=true
NEXT_PUBLIC_ENABLE_STAKING=true
```

You can run the ui against a forked network similar to what the tests do which allows you to play around on the ui without spending actual funds.
To enable forks in the ui, you have to run the following commands in console.
## Running Against a Chain Fork

You can run the UI locally against a forked chain network, similar to what the tests do with Tenderly. This will allow you to build and interact with the UI without spending actual funds. This is very useful for testing many protocol scenarios.

First, you’ll need to create a fork of a network, which can be done with a few different tools. We suggest using the one created by Bored Ghost Labs, where you can follow the steps and get set up [here](https://github.com/bgd-labs/aave-tenderly-cli).

Second, you’ll need to tell the local application which fork to run against. The easiest way to do this is to copy/paste the following statements. With the application running locally, open up the console in the browser and copy/paste the following with the appropriate values.

```js
localStorage.setItem('forkEnabled', 'true');
localStorage.setItem('forkBaseChainId', 1); // the networkId you are forking
localStorage.setItem('forkNetworkId', '3030'); // the networkId on the fork
localStorage.setItem('forkRPCUrl', <rpcurl>);
localStorage.setItem('forkBaseChainId', <chainId>); // the ID for the chain you are forking, in numeric format
localStorage.setItem('forkNetworkId', '3030'); // the ID of the new forked network
localStorage.setItem('forkRPCUrl', <rpcUrl>);
```

As localeStorage is not observed you need to **reload** after setting the parameters.
Now the market selection should show forked markets for all the markets that run on `forkBaseChainId`.
To do actual transactions on the fork you need to setup your wallet to use the same `rpcurl` you provided as `forkRPCUrl`.
Since `localStorage` changes are not not observed, _you’ll need to reload after setting the parameters_. After reloading, the market selection should show forked markets for all the markets that run on `forkBaseChainId`. To make actual transactions on the fork, you’ll need to setup your wallet to use the same `rpcUrl` you provided as `forkRPCUrl`. This will require you to setup your wallet by adding in the new fork network and connecting to the app with it.

## Token addition
If you are using MetaMask, make sure to configure the Tenderly fork RPC URL into a new network configuration. Give it a network name, and you'll want to use the same values that you copied into `localStorage` for the other fields. See below as an example:

To add a new token to the app, all you have to do is adding a svg token icon inside `public/icons/tokens` please make sure the svg name equals the `lowercase` onchain `symbol`.
If you want a custom name to appear alongside the icon you can alter `src/ui-config/reservePatches.ts` accordingly.
![MetaMask Forked Network Setup](/public/fork-config-example.png)

## Translations
Once you have both copied over the values into `localStorage` and have saved the new network configuration in MetaMask (or any other browser wallet), switch to the network in your wallet.

Aave uses [Crowdin](https://crowdin.com/project/aave-interface) for translation management.
Next, reload the page. The new forked network should appear in the dropdown list for markets in the application.

Feel free to reach out to us on discord to become a translator!
Finally, switch to the market pertaining to the fork in the dropdown list. Now you are able to interact with the Aave Protocol via the UI without spending any real funds!

We only update strings within the app. Everything else is downloaded from crowdin.
__NOTE:__ _Always double check the selected network in your wallet provider to make sure transactions are executed only on the fork network_.

[Crowdin Docs](https://support.crowdin.com/enterprise/cli/) for installation of the cli

To upload strings
## Token Additions

```sh
To add a new token to the app, the process is pretty simple. All you’ll need to do is add a new token icon SVG to the `public/icons/tokens` directory. The only requirement is that the name of the SVG file is equal to the asset’s `symbol` in all lowercase. If you want a custom name to appear alongside the icon, you can alter `src/ui-config/reservePatches.ts` accordingly.

crowdin upload sources
## Translations

```
Aave uses [Crowdin](https://crowdin.com/) for translation management and internationalization. We only update strings within the app. Everything else is downloaded from Crowdin. For more information, such as installing their CLI tool, read their [documentation](https://developer.crowdin.com/api/v2/).

To upload strings:

To download strings
```bash
crowdin upload sources
```

```sh
To download strings:

```bash
crowdin download

```

To add a new language first start an issue to check for public interest.
If the community decides to go forward with your preferred language follow [this pr](https://github.com/aave/interface/pull/447#issue-1165545965) to add support for a new language.
If you would like to add support for a new language across the app, please [open up an issue](https://github.com/aave/interface/issues/new/choose) and add the `i18n` label to it. This helps us categorize, and it will also help to gauge public interest for the new language. If the community decides to go forward with your preferred language, you may open up a pull request. Please follow the template of [this PR](https://github.com/aave/interface/pull/447#issue-1165545965).

**Feel free to reach out to us on [Discord](https://discord.gg/aave) to become a translator!**
Binary file added public/fork-config-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.