{"repo":"andreitoma8/learn-yul","free":true,"listed":false,"github":"https://github.com/andreitoma8/learn-yul","clone":"git clone https://github.com/andreitoma8/learn-yul.git","description":"Educational notes on Yul (Solidity Assembly) and how to use it inside Solidity Smart Contracts.","language":null,"stars":260,"topics":["solidity","solidity-assembly","solidity-contracts","yul"],"license":null,"category":"blockchain-web3","readme_excerpt":"Learn Yul This repository is a collection of my notes taken in the process of learning Yul. Props to Jeffrey Scholz for his Yul course. Contents: - Yul Syntax - Yul Types - Yul Basic Operations - Yul Functions - Storage Slots & Variables - Memory - Calls - Contract fully written in Yul Bonus: Solidity vs Yul CrowdFunding Contract Description Yul is an intermediate language that can be compiled to bytecode for different backends. It can be used in stand-alone mode and for “inline assembly” inside Solidity. The compiler uses Yul as an intermediate language in the IR-based code generator (“new codegen” or “IR-based codegen”). Yul is a good target for high-level optimisation stages that can benefit all target platforms equally. Yul Syntax - To write Yul code in Solidity, use the assembly keyword. In in-line assembly, variables are initialized on the stack. - Function syntax: - To declare a variable, use the let keyword. Yul Types Yul has only 1 type: bytes32 . This can hold any value. The compiler will automatically insert conversions as needed. For literals, the following types are available: - Integer constants in decimal or hexadecimal notation. - ASCII strings (e.g. \"abc\" ), which may contain hex escapes \\xNN and Unicode escapes \\uNNNN where N are hexadecimal digits. - Hex strings (e.g. hex\"616263\" ). For example, the following function will return true , 10 , and 0x48656c6c6f20576f726c64210000000000000000000000000000000000000000 which is the bytes32 representation of the \"He","default_branch":null,"files":null,"tree":[],"storefront":"/r/andreitoma8","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/andreitoma8/learn-yul/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}