Stake STK · earn more STK · ReentrancyGuard · 6 Hardhat tests
Two contracts:
StakeToken.sol — ERC-20 with onlyOwner mintStakingVault.sol — stake / withdraw / getRewardRewards accrue at a per-second rate the owner sets with setRewardRate. Guards:
ReentrancyGuard on stake, withdraw, getReward
Run on the author’s machine with Hardhat’s local network (no wallet, no public RPC):
npm install npx hardhat test
Evidence re-ran 2026-09-09 (ET): 6 passing, 0 failing (~3s). Exit code 0. No private key used. No testnet or mainnet transaction.
| Test | Result |
|---|---|
| Stake records the balance before the transfer returns | pass |
| Withdraw above staked amount reverts | pass |
| Withdraw returns principal | pass |
| Rewards accrue after 100 seconds (~100 tokens at 1 token/s) | pass |
| Two equal stakers earn about the same | pass |
Non-owner cannot change rewardRate | pass |
Source layout: test/StakingVault.js · JSON evidence in repo results/tests.json.
Author: Harsha Nandhan Reddy Gajulapalli · MIT · harshanandhanreddy820@gmail.com