skills/vulnerability-patterns/lack-of-precision/SKILL.md
- Contract performs integer arithmetic (division, fee calculations, reward distributions)
npx skillsauth add apegurus/solidity-argus lack-of-precisionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
function calculateFee(uint256 amount, uint256 daysEarly) external view returns (uint256) {
// Division BEFORE multiplication — truncates intermediate result
uint256 dailyRate = amount / 365; // Loses precision
uint256 fee = dailyRate * daysEarly; // Error compounds
// Correct: amount * daysEarly / 365 (multiply first)
return fee;
}
function distribute(uint256 reward, uint256 totalShares) external {
for (uint256 i = 0; i < holders.length; i++) {
// If reward < totalShares, this is always 0
uint256 share = reward / totalShares * balances[holders[i]];
_transfer(holders[i], share);
}
}
/) in arithmetic expressionsamount * rate / divisor instead of amount / divisor * ratemulDiv from OpenZeppelin or PRBMath for safe full-precision multiplication then division// Correct: multiply first, then divide
uint256 fee = amount * daysEarly / 365;
// With scaling for precision
uint256 WAD = 1e18;
uint256 scaledRate = (amount * WAD) / totalSupply;
uint256 reward = (scaledRate * userBalance) / WAD;
testing
Specialist profile for mechanically applying the attack-vector deck and classifying vectors as skip, drop, or investigate.
tools
Specialist profile for libraries, helpers, base contracts, adapters, encoders, wrappers, and integration glue.
testing
Specialist profile for rounding, scale, decimal, downcast, and arithmetic accounting edge cases.
testing
Specialist profile for extracting conservation laws and state couplings, then searching for violating paths.