ERC20 Drain
Prevent tokens from being drained from a contract
Use Case
One of the most common things that happen when a protocol is exploited is that the attacker drains all the tokens from the protocol. Having assertions in place that prevent draining can be helpful to prevent or at the very least slow down the rate at which a protocol is drained.
Explanation
Check that the token balance of a contract does not decrease by more than X% in a single transaction. Each individual protocol should define their own percentage based on user patterns and expected behavior.
Note: This does not prevent draining from happening, as a somewhat capable attacker would just drain X-1% of the tokens in a single transaction. It’s better than nothing and if mitigation is in place it could pause the protocol on a draining attempt.