/staking-app

Primary LanguageTypeScript


Logo

Staking Vault Dapp Contracts

A simple staking vault that uses stake as collateral on compound to generate yield

Table of Contents
  1. About The Project
  2. Getting Started
  3. License

About The Project

⊛ Users can stake their ETH in the vault (Constant APR 10%)

⊛ User gets rewarded in devUSDC which is an Erc20 token

⊛ We assume that devUSDC is always worth $1

⊛ When a user stakes ETH: all of that ETH will be put as collateral in Compound (v2).

⊛ When a user wants to Withdraw their ETH, the vault will take out the ETH the user staked (without the yields) from Compound and will give it back to the user with the devUSDC rewards

⊛ Minimum amount to stake is 5 ETH

⊛ To get the price of ETH you will need to use a price oracle from chainlink

(back to top)

Built With

  • Solidity
  • Hardhat
  • OpenZeppelin
  • Chainlink
  • Chai + Mocha.js
  • Typescript

(back to top)

Getting Started

All the contracts have been deployed on Goerli Network and are verified.

  • DevUSDC Contract Address

    0xa5Fb9606C90939C7Bb65dd7C36Bbc1Ea08F1b756
  • Vault Contract Address

    0x4D21b1E86dEc5aa7F63eE62c54813aD29d2c2A8e
  • CEth Contract Address

    0x64078a6189Bf45f80091c6Ff2fCEe1B15Ac8dbde

Prerequisites

You need a package manage like yarn or npm. I used yarn. After cloning repo:

  • yarn

    yarn install
    yarn hardhat compile
    yarn hardhat test

    You also need your .env file set up as such:

  • .env

    ETHERSCAN_API_KEY=[Etherscan key]
    GOERLI_URL=[Alchemy or Infura Url]
    PRIVATE_KEY=[Your goerli private key]

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)