Coder Social home page Coder Social logo

sevasoft / defi-stake-yield-brownie Goto Github PK

View Code? Open in Web Editor NEW

This project forked from patrickalphac/defi-stake-yield-brownie

0.0 1.0 0.0 2.06 MB

Solidity 41.37% HTML 1.86% TypeScript 31.48% CSS 0.86% JavaScript 5.75% Python 18.44% Shell 0.23%

defi-stake-yield-brownie's Introduction

defi-stake-yield-brownie


Full Stack Example


Summary

This is a repo to build your own full stack defi staking application for yield farming, borrowing and lending, or any other project you can think of. It allows you to:

  • stakeTokens: Add any approved token to the farming contract for yeild farming, collateral, or whatever you want to do.
  • unStakeTokens: Remove your tokens from the contract.
  • getUserTotalValue: Get the total value that users have supplied based on calculations from the Chainlink Price Feeds.
  • issueTokens: Issue a reward to the users staking on your platform!

And more!

Prerequisites

Please install or have installed the following:

Installation

  1. Install Brownie, if you haven't already. Here is a simple way to install brownie.
pip install --user pipx
pipx ensurepath
# restart your terminal
pipx install eth-brownie

Or if you can't get pipx to work, via pip (it's recommended to use pipx)

pip install eth-brownie
  1. Clone this repo
git clone https://github.com/PatrickAlphaC/defi-stake-yield-brownie
cd defi-stake-yield-brownie
  1. Install ganache-cli
npm install -g ganache-cli

If you want to be able to deploy to testnets, do the following.

  1. Set your environment variables

Set your WEB3_INFURA_PROJECT_ID, and PRIVATE_KEY environment variables.

You can get a WEB3_INFURA_PROJECT_ID by getting a free trial of Infura. At the moment, it does need to be infura with brownie. You can find your PRIVATE_KEY from your ethereum wallet like metamask.

You'll also need testnet rinkeby or Kovan ETH and LINK. You can get LINK and ETH into your wallet by using the rinkeby faucets located here. If you're new to this, watch this video.

You'll also want an Etherscan API Key to verify your smart contracts.

You can add your environment variables to the .env file:

export WEB3_INFURA_PROJECT_ID=<PROJECT_ID>
export PRIVATE_KEY=<PRIVATE_KEY>
export ETHERSCAN_TOKEN=<YOUR_TOKEN>

DO NOT SEND YOUR KEYS TO GITHUB If you do that, people can steal all your funds. Ideally use an account with no real money in it.

Useage

Scripts

brownie run scripts/deploy.py

This will deploy the contracts, depoly some mock Chainlink contracts for you to interact with.

brownie run scripts/deploy.py --network kovan

This will do the same thing... but on Kovan.

Front end

cd front_end
yarn
yarn start

and you'll be able to interact with the UI

Testing

brownie test

Linting

pip install black 
pip install autoflake
autoflake --in-place --remove-unused-variables -r .
black .

Resources

To get started with Brownie:

Shoutout to Matt Durkin on twitter for creating the UI! Shoutout to Gregory from Dapp University for the inspiration for this!

Any questions? Join our Discord or open an issue.

License

This project is licensed under the MIT license.

defi-stake-yield-brownie's People

Contributors

patrickalphac avatar sevamove avatar

Watchers

 avatar

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.