solidityTips

    0

    0

    lucycodes42

    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.
    i.e.,
    1_000 is a thousand
    1_0_0_0 is a thousand
    1_000e0_3 is a million
    
    Python spec https://www.python.org/dev/peps/pep-0515/
    
    ------------------------------
    Contribute tips here: https://github.com/juanfranblanco/vscode-solidity/blob/master/snippets/solidity.json#L197-L201 
    Escape the text using: https://www.freeformatter.com/json-escape.html
    ------------------------------
    
    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.