To understand why constructors pose a problem in implementation contracts, we need to first understand how contract deployment works and then see how this interacts with the proxy pattern. Let's build this understanding step by step. The Contract Cre...
Introduction Yul is an intermediate language that can be used with Solidity or as a standalone language . It is particularly useful for writing optimized Smart Contract Lets look at some Coding Examples { // Declare variables without specifying t...
Alright Let’s Continue from where we left , Previous One : Demystifying Memory in EVM (Part I) Memory Initialization When a contract is executed , the EVM initializes a free memory pointer to 0×80. This is done to provide some space for stack operati...
Okay let’s first look at the code contract Demo { uint256 a = 0x1a01; // Slot 0 uint256 b = 0x2a01; // Slot 1 mapping(uint => uint) c; // Slot 2 uint256 d = 0x5a01; // Sot 3 constructor(){ c[10] = 0xfe3f; c[100] =...
When Storing Dynamic type data , We don’t explicitly store the data in the next immediate slot, instead we only store the address of the slot where the element of that index is , In simpler words we are basically storing the “Pointer” to the actual a...
Let’s first have a look at the Code contract Demo{ uint256 a 1234 // slot 0 uint8 b = 0x12; // slot 1 uint8[6] c = [1,2,3,4,5,6]; // line 4 (slot 2) uint256[2] d = [10,20] // line 5 slot(3 & 4) function getSlotvalue(uint slot) public...
In this article, I examined how arrays, structs and mappings are stored on the EVM, but before we dive into this, lets talk about what storage looks like in the EVM. Understanding how EVM storage works is crucial for efficient smart contract developm...
I promised to write about storage... And here it is. Hi, just in case you have not read my other articles, I am your go-to girl anytime you need a simplification of solidity and blockchain. You would be happy if you dived into my homepage to see what...
Can we say the Ethereum Virtual Machine (EVM) is like a computer that exists on the Ethereum network or a special computer where all the action happens on the Ethereum network?Just as you use your computer to run programs, the EVM is where programs o...