Skip to content

fix: allow custodian to freeze full balance, add edge tests, and clean unused code #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ruhulamin1398
Copy link

@ruhulamin1398 ruhulamin1398 commented Jul 15, 2025

Summary

This PR improves the ERC20Custodian contract by:

  • Fixing the freeze function to allow freezing up to the user's total balance rather than just the available (unfrozen) balance.
  • Adding edge test cases covering full balance freeze, zero freeze, and updates to frozen amounts.
  • Removing unused code: the TokensUnfrozen event and ERC20InsufficientFrozenBalance error which were declared but never used.
  • Updating NatSpec comments in the contract for clarity.
  • Updating the documentation Markdown file to reflect the revised behavior.

Changes

  • ✅ Updated freeze() to check against balanceOf() instead of availableBalance()
  • ✅ Added edge test cases for freezing entire balance, freezing zero tokens, and modifying frozen balances
  • ✅ Removed unused TokensUnfrozen event and ERC20InsufficientFrozenBalance error
  • ✅ Improved doc comments in the Solidity contract
  • ✅ Updated docs/token/ERC20/extensions/ERC20Custodian.md to match code changes

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