Rules › Solidity

Floating pragma

lowSolidityRule sol-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

ToolDetector or reference
Slitherpragma
Solhintcompiler-version
Aderynunspecific-solidity-pragma
SWC registrySWC-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.

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.