pragma-and-addresses
Skill36 starsChanged 5 months agoMITView on GitHub
Detect floating pragma, hardcoded addresses, missing zero-address checks, deprecated Solidity versions. Activate on every `pragma solidity` line, `constant ADDRESS = 0x...`, `immutable` address parameters, address comparisons.
In this repository44 other files it gives its agents.
- access-controlSkill
- approval-issuesSkill
- caching-and-incrementalSkill
- centralization-riskSkill
- confidence-scoringSkill
- cosmwasmSkill
- cross-chain-messagingSkill
- cross-contract-stateSkill
- delegatecall-risksSkill
- diamond-eip2535Skill
- dos-vectorsSkill
- erc1271-contract-signaturesSkill
- erc4337-account-abstractionSkill
- erc4626-inflationSkill
- false-positive-feedback-loopSkill
- fee-on-transferSkill
- flash-loan-attacksSkill
- initializationSkill
- inline-assemblySkill
- integer-issuesSkill
- intents-erc7683Skill
- known-good-comparisonSkill
- liquidation-cascadeSkill
- mev-frontrunningSkill
- mev-pbsSkill
- multi-pass-self-critiqueSkill
- oracle-manipulationSkill
- oracle-redundancySkill
- permit2-patternsSkill
- progress-and-streamingSkill
- reentrancySkill
- restaking-eigenlayerSkill
- selfdestruct-eip6780Skill
- signature-malleabilitySkill
- signature-replaySkill
- solana-anchorSkill
- storage-layoutSkill
- stylus-rustSkill
- token-compatibilitySkill
- tx-context-misuseSkill
- unchecked-callsSkill
- ve-lock-governanceSkill
- vyper-specificSkill
- zk-verifier-bugsSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 86
Use OZ Ownable2Step so even a bad zero-address would require accept().
- Distinctive: line 91
Test/mock files with hardcoded addresses are fine.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Pragma & address-hygiene detection
When this applies
- Top of every Solidity file
- Constants and immutables typed
address - Constructor / initializer parameters typed
address mapping(address => …)updates- Any cross-chain deployment where addresses differ per chain
Detection patterns
Floating pragma (LOW-MEDIUM)
pragma solidity ^0.8.0; // ← floats to any 0.8.xProduction deployments should pin: pragma solidity 0.8.24;. Floating pragma means audited bytecode ≠ deployed bytecode.
Outdated Solidity version (MEDIUM)
<0.8.0 lacks built-in overflow checks. <0.8.20 lacks PUSH0 opcode handling for some L2s. Audit pin date vs known compiler bugs.
Hardcoded address tied to a single chain (HIGH)
address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // ← mainnet WETH, breaks on Base/ArbitrumWETH/USDC/USDT all have different addresses per chain. Use a chain-configurable resolver.
Missing zero-address check (HIGH on key fields)
function setOwner(address newOwner) external onlyOwner {
owner = newOwner; // ← if 0x0, contract is bricked
}Affects ownership, oracles, treasury, fee receiver, token addresses.
Address(0) as default sentinel (MEDIUM)
Using address(0) to mean "unset" works but is brittle — collides with default mapping values.
payable(0) as burn (LOW-MEDIUM)
Burning by sending to address(0)'s payable is legal but locks ether forever. Document intent.
address(this) in cross-chain context (HIGH for CREATE2 deployments)
address(this) differs unless deterministically deployed at same address across chains.
address public foo; instead of address public immutable foo; (LOW)
Mutable when it shouldn't be — gas cost + risk of accidental setter.
Chain-ID-dependent address resolution missing (HIGH)
if (block.chainid == 1) router = MAINNET_ROUTER;
else if (block.chainid == 42161) router = ARB_ROUTER;
else revert("unsupported chain"); // ← without this, unsupported chain silently uses mainnet addressSeverity rubric
| Pattern | Severity |
| Hardcoded mainnet address in multi-chain deployment | High |
| Missing zero-address check on owner/admin set | High |
| Chain-ID-based resolver missing for cross-chain | High |
| Outdated Solidity version with known CVE | High |
Floating pragma (^0.8.0) in production | Medium |
| Mutable address that should be immutable | Low |
| Outdated but CVE-free Solidity version | Low |
| Comment-only address documentation outdated | Info |
Remediation patterns
- Pin exact Solidity version:
pragma solidity 0.8.24;(or whatever you tested with). - Zero-address checks on every setter:
require(newAddr != address(0), "zero address");. - Chain-aware address resolver:
function _weth() internal view returns (address) { if (block.chainid == 1) return MAINNET_WETH; if (block.chainid == 8453) return BASE_WETH; if (block.chainid == 42161) return ARB_WETH; revert UnsupportedChain(); } - Use OZ
Ownable2Stepso even a bad zero-address would require accept(). - For immutable-when-possible, mark with
immutablekeyword.
False-positive notes
- Test/mock files with hardcoded addresses are fine.
address(0)checks may be redundant if subsequent OZ library calls already validate.- Floating pragma in libraries (vs deployed contracts) is sometimes intentional.
Related
- [[access-control]]
- [[storage-layout]]
- [[upgrade-safety]]
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

