Skip to content

Add comprehensive tests for PillarStakedToken contract - #15

Open
AdekunleBamz wants to merge 3 commits into
pillarwallet:mainfrom
AdekunleBamz:main
Open

Add comprehensive tests for PillarStakedToken contract#15
AdekunleBamz wants to merge 3 commits into
pillarwallet:mainfrom
AdekunleBamz:main

Conversation

@AdekunleBamz

Copy link
Copy Markdown

Summary

This PR adds comprehensive test coverage for the PillarStakedToken (stkPLR) ERC20 token contract.

File Added

  • test/PillarStakedToken.spec.js - Complete test suite for PillarStakedToken

Test Coverage (20+ test cases)

Deployment Tests:

  • Contract deploys with correct name and symbol
  • DEFAULT_ADMIN_ROLE is set to deployer
  • Initial MINTER_ROLE is granted to deployer

Minting Tests:

  • MINTER_ROLE holder can mint tokens
  • Non-minter cannot mint tokens
  • Role granting works correctly
  • Revoked minter cannot mint

Burning Tests:

  • Token holder can burn their tokens
  • Cannot burn more than balance

Transfer Restriction Tests:

  • Non-MINTER_ROLE cannot transfer tokens
  • MINTER_ROLE can transfer on behalf of users
  • Cannot transfer to zero address

Role Management Tests:

  • Admin can revoke MINTER_ROLE
  • Role revocation prevents minting

ERC20 Standard Tests:

  • Correct decimals (18)
  • Total supply returns valid value
  • Allowance works correctly
  • TransferFrom decreases allowance

Why This Matters

PillarStakedToken is a critical component of the Pillar DAO ecosystem:

  1. Staking mechanism relies on this token
  2. Transfer restrictions ensure only staking contract can move tokens
  3. Role-based access control for minting

Testing

Run tests with:

npx hardhat test test/PillarStakedToken.spec.js

adekunle added 3 commits January 10, 2026 14:59
- Added test coverage for PillarStakedToken (stkPLR) ERC20 token
- Tests cover deployment, minting, burning, transfer restrictions
- Tests cover role management (MINTER_ROLE, DEFAULT_ADMIN_ROLE)
- Tests cover ERC20 standard functionality (decimals, totalSupply, allowance)
- 20+ test cases covering all major functionality
- Added complete pillar-dao-contracts project
- Added comprehensive tests for PillarStakedToken contract (20+ test cases)
- Tests cover deployment, minting, burning, transfers, roles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant