https://github.com/deco31416/lp-token-staking
A NextJS dapp to stake LP tokens into a pool contract and earn a reward in a reward token
https://github.com/deco31416/lp-token-staking
Last synced: 3 months ago
JSON representation
A NextJS dapp to stake LP tokens into a pool contract and earn a reward in a reward token
- Host: GitHub
- URL: https://github.com/deco31416/lp-token-staking
- Owner: deco31416
- Created: 2022-05-31T08:40:10.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-05-31T09:44:25.000Z (almost 3 years ago)
- Last Synced: 2025-01-10T23:19:35.535Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 844 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Staking Dapp for the ETB token
A Dapp to stake LP tokens into a pool contract and earn rewards tokens in return.
The pool implements an efficient O(1) algo to distribute the rewards based on the paper [calable-reward-distribution-paper](https://uploads-ssl.webflow.com/5ad71ffeb79acc67c8bcdaba/5ad8d1193a40977462982470_scalable-reward-distribution-paper.pdf
)Features included:
- The staking contract allows an admin to define multiple rewards periods. These are time intervals when a certain amount of reward tokens will be distributed to stakers.
- Users staking their LP tokens into the pool during a reward period, will earn part of the allocated reward tokens.
- The amount of reward tokens earned is proportional to the amount of tokens staked and the length of the staking period.
- The pool contract will distribute reward tokens at a constant rate (e.g x reward tokens per second) amoung all active stakers.
- Users can add and remove tokens from their staked amount at any time during a reward period.
_ Users can claim their accrued reward tokens.
- When users end their stake, they get back their LP tokens and all the reward tokens accrued so far.### To run the tests
```
truffle develop // starts a local blockchain on port 7545
truffle test // runs the test```
### Setup environment
Install node
`brew install node` (on Mac)Install truffle
`npm install -g truffle`### To run the dapp locally
1. Install dependencies
`npm install`2. Start a local blockchain and deploy the contracts in truffle
```
truffle develop // starts a local blockchain on port 7545
truffle migrate // deploy the contracts
```3. Start the nextjs server
`npm run dev`4. Connect Metamask to the local netwotk on http://127.0.0.1:7545/
5. Access the dapp
`http://localhost:3000/`Note:
Metamask has to be connected to the local truffle netowork on port 7545 :
```
New RPC URL: http://127.0.0.1:7545/
Chain ID: 1337
```### User Page
- The user page allows to stake, unstake LP tokens and claim a reward:


### Admin Page
- The admin page allows to create a reward phase to distribute an allocated amount of reward tokens among stakers.
