Skip to content

Commit a3ddfb3

Browse files
committed
first commit
0 parents  commit a3ddfb3

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

README.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Defi Yield Aggregator
2+
This project is a simple decentrialized app where a user can deposit DAI into our smart contract.
3+
Once funds are deposited, the contract compares the interest rate of Compound & Aave, and deposits
4+
funds to whichever has the highest interest rate. The user can rebalance his/her funds to ensure
5+
that the funds are still currently in the higher interest rate protocol, and can also withdraw at
6+
any time.
7+
8+
## Technology Stack & Tools
9+
10+
- Solidity (Writing Smart Contract)
11+
- Javascript (React & Testing)
12+
- [Web3](https://web3js.readthedocs.io/en/v1.5.2/) (Blockchain Interaction)
13+
- [Truffle](https://www.trufflesuite.com/docs/truffle/overview) (Development Framework)
14+
- [Ganache-cli](https://github.com/trufflesuite/ganache) (For Local Blockchain)
15+
- [Infura.io](https://infura.io/) (For copying the Ethereum mainnet)
16+
- [MetaMask](https://metamask.io/) (Ethereum Wallet)
17+
- Openzeppelin (Solidity Math)
18+
19+
## Requirements
20+
- Install [NodeJS](https://nodejs.org/en/), I recommend using node version 10.16.3 to avoid any potential dependency issues
21+
- Create or log in to your [Infura.io](https://infura.io/login) account and create a new project, and save your project ID located in your project settings, you'll need this when starting the ganache-cli server.
22+
- Install [MetaMask](https://metamask.io/) in your browser.
23+
- Install [Ganache-cli](https://github.com/trufflesuite/ganache). To see if you have ganache-cli installed, in your command line type `ganache-cli --version`. To install, in your command line type `npm install ganache-cli --global`
24+
25+
## Setting Up
26+
### 1. Clone the Repository:
27+
`$ git clone https://github.com/dappuniversity/yield-aggregator.git`
28+
29+
### 2. Install Dependencies:
30+
```
31+
$ cd yield-aggregator
32+
$ npm install
33+
```
34+
35+
### 3. Start Ganache-cli
36+
In a separate CMD prompt/terminal run:
37+
```
38+
$ ganache-cli -f https://mainnet.infura.io/v3/<Your-Project-ID> -m <Your-Mnemonic-Phrase> -u 0x9759A6Ac90977b93B58547b4A71c78317f391A28 -p 7545
39+
```
40+
41+
Replace `Your-Project-ID` with your Infura Project ID located in the settings of your project.
42+
Replace `Your-Mnemonic-Phrase` with your own mnemonic phrase. If you don't have a mnemonic phrase to include you can omit it:
43+
```
44+
$ ganache-cli -f https://mainnet.infura.io/v3/<Your-Project-ID> -u 0x9759A6Ac90977b93B58547b4A71c78317f391A28 -p 7545
45+
```
46+
47+
If you didn't include a mnemonic phrase, after starting the ganache server it will supply you with one, plus 10 accounts you can use,
48+
I recommend saving that mnemonic phrase to use it when you need to start (or restart) ganache, and import the 1st private key listed in MetaMask so you can interact with the frontend.
49+
50+
### 4. Migrate Smart Contracts
51+
`$ truffle migrate --reset`
52+
53+
### 5. Mint DAI
54+
`$ node ./mint-dai/dai.js`
55+
56+
### 6. Run Frontend Application
57+
In a separate CMD prompt/terminal run:
58+
`$ npm start`
59+
60+
### 6. (Optional) Test Smart Contracts
61+
`$ truffle test`
62+
63+
## Potential Errors
64+
```
65+
Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced
66+
```
67+
68+
This error can happen if you update the smart contract by running a migration. To solve this error, restart your Ganache-cli, run migrations, and mint DAI to your account (Essentially repeat steps 3-5 in project setup). You may have to also reset your MetaMask transactions if you completed any previous transactions, see error below.
69+
70+
```
71+
RPC Error: Error: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603,"data":{"message":"the tx doesn't have the correct nonce...
72+
```
73+
74+
You may come across this error while making a transaction, this error can happens if you previously handled any transaction with your MetaMask account and restarted your ganache-cli server. You'll have to reset your MetaMask account by going into your MetaMask settings > advanced > reset account.
75+
76+
```
77+
Error: while migrating Migrations: Returned error: project ID does not have access to archive state
78+
```
79+
80+
This error may come up while trying to run `$ truffle test`, to solve this issue, simply restart your ganache-cli. This will mean having to re-mint your account with DAI# Yield-Aggregator

0 commit comments

Comments
 (0)