Rules › Solidity
Floating pragma
pragma solidity ^0.8.0 lets a deployment use a compiler you didn't test with; pin the version you audited.
Why it matters
A floating pragma (^0.8.0, >=0.8.0) lets the contract be compiled, and deployed, with a compiler version you never tested or audited, possibly one with a known bug. Pin the exact version your tests and audit used. Libraries meant to be imported by others may float; deployed contracts shouldn't.
Vulnerable
pragma solidity ^0.8.20;
Fixed
pragma solidity 0.8.28;
What other tools call it
| Tool | Detector or reference |
|---|---|
| Slither | pragma |
| Solhint | compiler-version |
| Aderyn | unspecific-solidity-pragma |
| SWC registry | SWC-103 |
Check your code
Paste a contract into the in-browser checker, or let the Claude Code plugin scan before every deploy. The quick check for this rule is a pattern match: treat a hit as "look here", and a miss as no guarantee.
Related rules
- tx.origin used for authorization
- State written after an external call (reentrancy)
- Return value of a low-level call is ignored
- delegatecall to an address the caller controls
- Initializer anyone can call
- Privileged function without access control
Static analysis finds known bug classes; it can't prove code is safe and isn't an audit. Get a professional audit before deploying code that will hold value.