ASSEMBLY : RETURN THE VALUE OF UINT STORAGE VARIABLE BY USING SLOAD() AND MSTORE() OPCODES
In this video we will use Assembly language, which is a low-level language that allows for greater control over the code and increased efficiency.
The first function "foo1" uses the "sload" opcode to load the value of "num" from contract storage to an EVM register, then uses "mstore" to store it in the main memory and return it. The second function "foo2" uses a local variable "x" to load the value of "num" into main memory at a random location, then uses "mstore" to store it in a specific location in the main memory and return it.
We'll explain the purpose and limitations of these two assembly functions, and show how to use them in your own Solidity smart contracts. We'll also discuss the concept of EVM registers and their role in contract execution.
GITHUB:
https://github.com/abdulhakim-altunka...
We will create our Solidity smart contract by using Remix.
NOTE: All videos on this channel are for exercise purposes. For tutorial purposes I kindly advise you to watch great teachers below:
Solidity:
1) Smart Contract Programmer:
/ @smartcontractprogrammer
2) Eat the Blocks:
/ @eattheblocks
3) Dapp University:
/ @dappuniversity
Node-React-Javascript:
1) The Net Ninja:
/ @netninja
2) Dave Gray :
/ @davegrayteachescode
For Comments & Questions:
[email protected]
Buy me a Coffee:
buymeacoff.ee/softtomato