Coder Social home page Coder Social logo

staking-example's Introduction

Staking Example DApp

A simple staking contract connected to a Nextjs Front end.

Features

  • User can connect Metamask wallet to stake and withdraw
  • Owner can issue reward to staked users
  • Issue and reward your own token
  • Supported tokens: Wone, Weth, Dai

Tech

  • Hardhat - Ethereum development environment
  • NextJS - The React Framework for Production!
  • TailwindCSS - A utility-first CSS framework

Configuration

These following steps is for deploying and using contract on Harmony testnet. You can change to any network you like by changing the config.

Step 1. Set up environment variables

Copy the .env.example file in this directory to .env (which will be ignored by Git):

cp .env.example .env

Then set each variable on .env.local:

Your .env file should look like this:

PRIVATE_KEY=...

Step 2. Install dependencies

npm install

# or

yarn

Step 3. Deploy your own contract

npx hardhat run scripts/deployToHarmony.ts --network harmony_testnet

# or

hh run scripts/deployToHarmony.ts --network harmony_testnet

Your contract should be deployed to Harmony Testnet. The staking contract and token contract address should be printed on terminal.

NDTToken deployed to: ...
TokenFarm deployed to: ...

You can check the address on https://explorer.pops.one/

Step 4. Copy contract abi to front end

cp -R artifacts front_end/src/lib/

Step 4. Run Next.js in development mode

cd front_end && npm install && npm run dev

# or

cd front_end && yarn && yarn dev

Your DApp should be up and running on http://localhost:3000!

staking-example's People

Contributors

ndthinh8796 avatar

Stargazers

Ekacitta Wibisono avatar

Watchers

James Cloos avatar  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.