Blockchain Token Staking dApp built with React, Solidity, Truffle on Ethereum testnet, Polygon, Binance Smart Chain, BSC, zkEVM, Coinbase Base Chain, BASE
Working Demo: https://ibnz-staking.netlify.app/
IMPORTANT
This application and its code is NOT free to use, modify or resale. By using it you agree to not violate Plagiarism and Copyright Infringment
In order to use application code for modification or on own projects please contact [email protected] to obtain full licence.
The idea of me including licensing and restrictions is mainly to protect users from reselling the software. The software was created for educational purposes and should be used mainly as a reference.
However, there are a few very successful projects who are using my code without giving credit back. My application description is included on their whitepaper, where developers claim that this is the product they developed. Some haven't even changed the UI :)
In order to stop scenarios like this, I included a little description where I mention the License for the software.
The License is a written agreement from me that issues full rights to modify, resell, and use software and code without giving credit to the author or original repo.
The License fee is 0.3 ETH
I charge everyone the same price and I found this to be a genuine and fair price to charge.
git clone https://github.com/ibnzUK/Token-Staking-dApp
)npm install
)npm run start
)truffle test
/scripts
foldertruffle exec scripts/changeAPY.js 0.137
this script takes 1 argument (daily APY), in this provided example, admin sets 0.137
daily APY
truffle exec scripts/redistribute.js
or provide argument custom
if you want to redistribute custom rewards
TestToken deployment
✓ token deployed and has a name (246ms)
TokenStaking deployment
✓ staking contract deployed and has a name (160ms)
✓ checking default APY value (179ms)
✓ checking custom APY value (128ms)
✓ staking contract has 500k TestTokens tokens inside (176ms)
TokenStaking stakeTokens function
✓ users balance is correct before staking (126ms)
✓ checking total staked before any stakes (126ms)
✓ approving tokens, staking tokens, checking balance (1259ms)
✓ checking contract balance after staking (156ms)
✓ checking user balance inside contract (131ms)
✓ checking total staked (136ms)
✓ testing if user is staking at the moment (148ms)
✓ testing if user has staked (145ms)
TokenStaking redistributeRewards function
✓ checking who can do redistribution (1059ms)
✓ checking TokenStaking balance (105ms)
✓ checking user balance (130ms)
TokenStaking unstakeTokens function
✓ unstaking and checking users balance after unstake (468ms)
✓ checking total staked (132ms)
TokenStaking [custom] staking/unstaking functions
✓ checking total custom staked before any stakes (132ms)
✓ checking users balance before staking (165ms)
✓ approving tokens, staking tokens, checking balance (1131ms)
✓ checking custom total staked (125ms)
✓ testing if user is staking at custom staking at the moment (147ms)
✓ testing if user has staked at custom staking (107ms)
✓ unstaking from custom staking and checking users balance (535ms)
Claim Tst
✓ trying to obtain 1000 test token (395ms)
Change custom APY value
✓ checking who can change APY (1115ms)
✓ checking new custom APY value (146ms)
Testing custom APY reward redistribution
✓ staking at customStaking (1299ms)
✓ redistributing rewards, checking who can redistribute (733ms)
✓ checking user balance after custom APY rewards (111ms)
For private Ethereum test network make sure Ganache is running on HTTP://127.0.0.1:7545
truffle-config.js
with your infura key and mnemonic key. You can reate files in top dirrectory under names .infuraKey
and .secret
and paste your keys in there.gitignore
your keystruffle compile
truffle migrate --reset
or for Ethereum test network (Rinkeby) run: truffle migrate --network rinkeby --reset
or change rinkeby
to ropsten
.ethKey
and for (Rinkeby) run: truffle run verify TestToken --network rinkeby
or change rinkeby
to ropsten
TokenStaking Smart Contract Address on Test Net
TestToken Contract Address on Test Net
Current Admin on Test Net
Front end functions to Claim for 1000 Tst
token and Redistribute rewards or Custom redistribution
are only for testing purpose and showcase of application. Do not include or use them in your final project.