Dividend Token

Holder dividends and staking compete for the same balance · 33 Hardhat tests

Contract overview

Lab 33 / 33 Hardhat passing Solidity 0.8.24 Local Hardhat only

DividendToken.sol is a mintable ERC-20 with ETH-backed mint/burn and owner-pushed dividends:

Why this lab: after staking 300 of 1000 DTK, a 0.7 ETH distribution pays the holder 0.49 ETH (700/1000), not 0.7 ETH. Dividends follow the balance the contract sees.

Guards: ReentrancyGuard on mint, burn, withdraw, stake, unstake · onlyOwner on distributeDividends and fundStakingRewards.

How this dividend token works

How the tests work

Local Hardhat suite (no private key, no public network):

npm install
npx hardhat test

Evidence 2026-09-09: 33 passing, 0 failing, 534ms.

Hardhat test results for dividend token

33 tests by group

GroupTestsResult
Deployment3pass
Minting5pass
Burning4pass
Dividend distribution8pass
Transfers and dividend tracking1pass
Staking5pass
View functions2pass
Edge cases3pass
Reentrancy guards still complete2pass

The last two tests only check that burn and withdrawDividends finish under ReentrancyGuard. They are not an exploit suite and do not prove absence of bugs.

Source: test/DividendToken.test.js · evidence in results/tests.json and results/test-output.txt.

Links

Open GitHub repo Back to labs index

Author: Harsha Nandhan Reddy Gajulapalli · MIT · harshanandhanreddy820@gmail.com