Giter VIP home page Giter VIP logo

yield-aggregator's Introduction

Defi Yield Aggregator

This project is a simple decentrialized app where a user can deposit DAI into our smart contract. Once funds are deposited, the contract compares the interest rate of Compound & Aave, and deposits funds to whichever has the highest interest rate. The user can rebalance his/her funds to ensure that the funds are still currently in the higher interest rate protocol, and can also withdraw at any time.

Technology Stack & Tools

  • Solidity (Writing Smart Contract)
  • Javascript (React & Testing)
  • Web3 (Blockchain Interaction)
  • Truffle (Development Framework)
  • Ganache-cli (For Local Blockchain)
  • Infura.io (For copying the Ethereum mainnet)
  • MetaMask (Ethereum Wallet)
  • Openzeppelin (Solidity Math)

Requirements

  • Install NodeJS, I recommend using node version 10.16.3 to avoid any potential dependency issues
  • Create or log in to your Infura.io 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.
  • Install MetaMask in your browser.
  • Install Ganache-cli. 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

Setting Up

1. Clone the Repository:

$ git clone https://github.com/dappuniversity/yield-aggregator.git

2. Install Dependencies:

$ cd yield-aggregator
$ npm install 

3. Start Ganache-cli

In a separate CMD prompt/terminal run:

$ ganache-cli -f https://mainnet.infura.io/v3/<Your-Project-ID> -m <Your-Mnemonic-Phrase> -u 0x9759A6Ac90977b93B58547b4A71c78317f391A28 -p 7545

Replace Your-Project-ID with your Infura Project ID located in the settings of your project. Replace Your-Mnemonic-Phrase with your own mnemonic phrase. If you don't have a mnemonic phrase to include you can omit it:

$ ganache-cli -f https://mainnet.infura.io/v3/<Your-Project-ID> -u 0x9759A6Ac90977b93B58547b4A71c78317f391A28 -p 7545

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, 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.

4. Migrate Smart Contracts

$ truffle migrate --reset

5. Mint DAI

$ node ./mint-dai/dai.js

6. Run Frontend Application

In a separate CMD prompt/terminal run: $ npm start

6. (Optional) Test Smart Contracts

$ truffle test

Potential Errors

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

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.

RPC Error: Error: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603,"data":{"message":"the tx doesn't have the correct nonce...

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.

Error: while migrating Migrations: Returned error: project ID does not have access to archive state

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's People

Contributors

glitchical avatar gwmccubbin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yield-aggregator's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.