Skip to content

TS-mfon/abnormal-token-mint-detector-trap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Abnormal Token Mint Detector Trap

Drosera trap for detecting unexpected token minting by watching totalSupply() and triggering only when supply rises above a configurable percentage within a bounded block window.

Detection rule

  • Monitor one token’s totalSupply()
  • Compare newest sample vs oldest sample in the current window
  • Trigger when:
    • newSupply > oldSupply
    • blockWindow <= N
    • (newSupply - oldSupply) / oldSupply > X%

Default config in this example:

  • X = 5% (thresholdBps = 500)
  • N = 10 blocks
  • token = USDC mainnet address (replace for production)

Response behavior

The paired response contract implements:

function freezeAndAlert(MintAlert[] calldata alerts) external;

When called by TrapConfig, it:

  • marks token as frozen (tokenFrozen[token] = true)
  • emits TokenFrozen
  • emits GovernanceAlertTriggered

Files

  • src/AbnormalTokenMintTrap.sol
  • src/AbnormalTokenMintResponse.sol
  • test/AbnormalTokenMintTrap.t.sol
  • drosera.toml

Test

bun install
forge test

Caveat

Legitimate emissions (e.g. staking rewards, bridge minting, rebasing) can look suspicious, so tune threshold and sample window per token.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors