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.
- Monitor one token’s
totalSupply() - Compare newest sample vs oldest sample in the current window
- Trigger when:
newSupply > oldSupplyblockWindow <= N(newSupply - oldSupply) / oldSupply > X%
Default config in this example:
X = 5%(thresholdBps = 500)N = 10 blocks- token = USDC mainnet address (replace for production)
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
src/AbnormalTokenMintTrap.solsrc/AbnormalTokenMintResponse.soltest/AbnormalTokenMintTrap.t.soldrosera.toml
bun install
forge testLegitimate emissions (e.g. staking rewards, bridge minting, rebasing) can look suspicious, so tune threshold and sample window per token.