Code should not panic underflow
Description
There's several places in the protocol where proper code validation is missing by, instead, relying on panic errors. This is not recommended behaviour as per Solidity Docs: Properly functioning code should never create a Panic, not even on invalid external input.
If this happens, then there is a bug in your contract which you should fix. Here are the instances that rely on panic errors caught during the review:
- MToken._subtractEarningAmount
- MToken._subtractNonEarningAmount
- ERC20Extended.transferFrom
- DistributionVault.getClaimable
- PowerToken._divideUp
Recommendation
Raise proper errors instead of relying on panic.
Status