1/5
_Follow along with this video:_ --- ### Adding Things to Storage ```js #define macro SET_NUMBER_OF_HORSES() = takes(0) returns(0){ // 1. Get the value to store from call data // 2. Give numberOfHorses a storage slot // 3. Execute the SSTORE op code } ``` These are the steps, determined in our previous lesson, that we need to take in order to add the necessary logic to our Huff macro. For our first step, we're going to leverage the `SSTORE` op code. ::image{src='/formal-verification-1/28-sstore/sstore-1.png' style='width: 50%; height: auto;'} The stack inputs required are a **key** and a **value** - **Key** - 32 byte key - this is **where** in storage our data will be saved - **Value** - 32 byte value - this is **what** will be saved at our key's location in storage Note as well that this op code doesn't have any stack outputs. Executing this operation will pop the top two items off our stack and return nothing to it. Now that we understand how the `SSTORE` op code functions, we'll employ it in our contract in the next lesson.
A detailed explanation of the SSTORE opcode. This video lesson covers how to store data in the Ethereum Virtual Machine (EVM) using the SSTORE opcode. It explains how the opcode takes input from the stack and how this input gets written to storage. The video lesson also discusses why this opcode is particularly useful for storing the number of horses in a contract and provides a demonstration of its usage in the code.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Assembly
Writing smart contracts using Huff and Yul
Ethereum Virtual Machine OPCodes
Formal verification testing
Smart contract invariant testing
Halmos, Certora, Kontrol
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Guest lecturers:
Josselin Feist
Head of Blockchain at Trail of Bits
Last updated on January 17, 2025
Solidity Developer
Assembly and Formal VerificationDuration: 30min
Duration: 4h 38min
Duration: 3h 57min
Duration: 1h 56min
Course Overview
About the course
Assembly
Writing smart contracts using Huff and Yul
Ethereum Virtual Machine OPCodes
Formal verification testing
Smart contract invariant testing
Halmos, Certora, Kontrol
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Guest lecturers:
Josselin Feist
Head of Blockchain at Trail of Bits
Last updated on January 17, 2025
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar