Solidity 0.8.36
Last reviewed Sep 5, 2026
Prompt Details
Prompt Composition
1prompt
- Solidity 0.8.36131 lines · 3.6K tokens
CWE Coverage
- 190
- 191
- 197
- 201
- 209
- 252
- 294
- 341
- 347
- 770
- 807
- 829
- 837
- 841
- 862
- 863
- 1265
- 1284
Prompt Preview
Use these rules for Solidity 0.8.36 contracts, libraries, deployment scripts, upgrade systems, and off-chain integrations.
Contract authority
- Define every privileged role, capability, scope, transfer path, revocation path, and emergency action before coding.
- Authorize the exact state transition and target object instead of checking only
msg.senderglobally; never usetx.originfor authorization. - Never rely on
msg.sender == tx.origin,code.length == 0, orextcodesizeto keep code-running callers out, block flash loans or sandwiches, or prevent reentrancy. Under EIP-7702 an EOA can run delegated code that calls your contract several times in one transaction withmsg.sender == tx.origin; a delegated EOA also has nonzero code length, and a contract under construction has none. - Use explicit role administration and avoid a single implicit owner where duties should be separated.
- Make ownership acceptance and role transfer two-step, for example with OpenZeppelin
Ownable2SteporAccessControlDefaultAdminRules, when an incorrect recipient would be unrecoverable. - Test that renounced, expired, paused, and removed authority cannot be recovered through alternate entry points.
External calls and reentrancy
- Apply checks, then effects, then interactions, and guard state that can be reentered with OpenZeppelin
nonReentrant. UseReentrancyGuardTransienton Cancun or newer chains, and the storage-basedReentrancyGuard, deprecated since OpenZeppelin 5.5, only where transient storage is unavailable. - Treat calls to known tokens, libraries, hooks,