Solidity Code Snippets

    1️⃣ Use "type(uint256).

    Shortcut: solidity_tips

    //Paul Razvan Berg tips (@PaulRBerg)
    1️⃣ Use "type(uint256).max" instead of "uint256(-1)"
    2️⃣ Surround code with {} to avoid "stack too deep"
    3️⃣ Skip tuple vars with commas: "uint a, , ,"
    4️⃣ Swap vars in one line: "(a,b)=(b,a)"
    5️⃣ Use "assert" and get built-in formal verification with SMTChecker
    // Daniel Luca tips (CleanUnicorn.eth)
    1️⃣  You can format numbers in Solidity using underscores.
    1_000 is a thousand
    1_0_0_0 is a thousand
    1_000e0_3 is a million
    Python spec
    Contribute tips here: 
    Escape the text using:
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.