Install
openclaw skills install solidityAvoid common Solidity mistakes — reentrancy, gas traps, storage collisions, and security pitfalls.
openclaw skills install solidityReentrancyGuard from OpenZeppelin — use nonReentrant modifier on vulnerable functionstransfer() and send() have 2300 gas limit — but don't rely on this for securityunchecked {} blocks bypass this5 / 2 = 2, no decimalstype(uint256).max for max value — don't hardcode large numbersdelete refunds gas but has limits — refund capped, don't rely on itinternal — not private, derived contracts see themprivate doesn't mean hidden — all blockchain data is public, just not accessible from other contractstx.origin is original sender — use msg.sender, tx.origin enables phishing attacksexternal can't be called internally — use public or this.func() (wastes gas)payable required to receive ether — non-payable functions reject etherselfdestruct sends ether bypassing fallback — contract can receive ether without receive functionsend() — returns false on failure, doesn't revertcall{value: x}("") preferred over transfer() — forward all gas, check return valuestorage persists, memory is temporary — storage costs gas, memory doesn't persistmemory — explicit storage to modify statecalldata for external function inputs — read-only, cheaper than memoryinitialize() with initializer modifierselfdestruct implementation — breaks all proxies pointing to itdelegatecall uses caller's storage — impl contract storage layout must match proxyrequire for user errors, assert for invariants — assert failures indicate bugs== doesn't work — use keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b))indexed for efficient filtering