Smart contract Storage

  • This is where state variables are stored
  • It is persistent between function calls and transactions
  • It is a key-value mapping of 2256 keys; each value is 32 bytes long

State Variables Storage Layout

  • One Astronomically large array
  • Solidity generates code that saves variable values in their declaration order.
  • Variable first was declared first, it’s stored in slot 0
  • Items that need less than 32 bytes are packed together. See Rules

						contract Sample {
							uint first;    // storage slot 0
							uint second;   // storage slot 1
						}
					

Astronomically large array mental model

15 minute break

Lab

Follow the instructions on the readme file of proxy-delegate