Skip to content

feat: add adminBurn function to allow owner to destroy illegitimate t… - #302

Merged
blueogin merged 1 commit into
masterfrom
feat/supergooddollar-admin-burn
Sep 10, 2026
Merged

feat: add adminBurn function to allow owner to destroy illegitimate t…#302
blueogin merged 1 commit into
masterfrom
feat/supergooddollar-admin-burn

Conversation

@blueogin

@blueogin blueogin commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds adminBurn(address account, uint256 amount) to SuperGoodDollar so the DAO can destroy illegitimate G$ (e.g. tokens obtained through an exploit).

Removes recover(IERC20) to stay under the EIP-170 contract size limit.

Why not reuse _burn?

burn / burnFrom go through SuperGoodDollar._burn, which is unusable for a clawback:

_burn (override) SuperToken._burn SuperfluidToken._burn (used)
reverts while paused ✅ yes no no
runs holder's ERC777 tokensToSend hook ✅ yes ✅ yes no
  1. Pause. SuperGoodDollar._burn calls _onlyNotPaused(). Pausing is the first move in an incident and burning the illegitimate supply is the next, so the function would revert exactly when it is needed.
  2. ERC777 hook. SuperToken._burn calls _callTokensToSend, which invokes a contract the holder registered in the ERC1820 registry. A holder can register an implementer that always reverts and make themselves permanently un-burnable. The hook also fires before balances are updated, so it is a reentrancy surface — and adminBurn runs while paused, when other guards are off.

adminBurn therefore drops to SuperfluidToken._burn and emits Burned / Transfer itself. The available-balance check in SuperfluidToken._burn still applies, so a burn can never eat into the deposit backing an active Superfluid stream.

Access is _onlyOwner() (DEFAULT_ADMIN_ROLE). No new role was introduced — clawback is the most dangerous power on the token and should not be delegable by default.

About # (link your issue here)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • PR title matches follow: (Feature|Bug|Chore) Task Name
  • My code follows the style guidelines of this project
  • I have followed all the instructions described in the initial task (check Definitions of Done)
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have added reference to a related issue in the repository
  • I have added a detailed description of the changes proposed in the pull request. I am as descriptive as possible, assisting reviewers as much as possible.
  • I have added screenshots related to my pull request (for frontend tasks)
  • I have pasted a gif showing the feature.
  • @mentions of the person or team responsible for reviewing proposed changes

Summary by Sourcery

Enable the token owner to safely claw back illegitimate G$ while preserving Superfluid balance constraints.

New Features:

  • Add an owner-only admin burn capability for destroying illegitimate token balances, including while the token is paused.

Enhancements:

  • Remove the token recovery function to remain within the contract size limit.

Tests:

  • Add coverage for successful administrative burns, owner authorization, paused-state operation, and insufficient available balance reverts.

Copilot AI lite review requested due to automatic review settings September 7, 2026 20:26

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. The owner can now irreversibly destroy any holder's token balance, including potentially all circulating supply, without the holder's consent or an allowance. Reverting the contract would not restore tokens that were already burned, and an incorrect owner decision or compromised owner key would make the loss immediate and potentially unbounded.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

adminBurn currently lacks a zero-address guard (since SuperfluidToken._burn doesn’t check it), which can lead to misleading burn/transfer events and inconsistent revert behavior versus standard burn paths.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adds an owner-only adminBurn(address,uint256) to SuperGoodDollar to enable DAO-controlled clawback of illegitimate balances (including while paused) by burning via SuperfluidToken._burn (bypassing ERC777 hooks), and removes recover(IERC20) to help stay under the EIP-170 contract size limit.

Changes:

  • Add adminBurn to SuperGoodDollar and expose it via IGoodDollarCustom.
  • Remove recover(IERC20) from SuperGoodDollar.
  • Add test coverage for adminBurn behavior (supply reduction, auth, paused operation, insufficient available balance).
File summaries
File Description
test/token/SuperGoodDollar.test.ts Adds unit tests validating adminBurn authorization and burn behavior (including while paused).
contracts/token/superfluid/SuperGoodDollar.sol Implements adminBurn (owner-only, bypasses ERC777 hooks/pausable/fees) and removes recover.
contracts/token/superfluid/ISuperGoodDollar.sol Extends IGoodDollarCustom interface to include adminBurn.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread contracts/token/superfluid/SuperGoodDollar.sol
@blueogin
blueogin requested a review from sirpy September 7, 2026 20:30
@blueogin
blueogin merged commit 245a5c3 into master Sep 10, 2026
17 of 25 checks passed
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.

3 participants