Memory VS Storage in Solidity - Data Location Tutorial

preview_player
Показать описание
In this video I show you the different data location options we have in solidity and why you need to know. If you confuse the two your code could have serious errors ahead.

Рекомендации по теме
Комментарии
Автор

The better explanation that i've seen until now, congrats Filip !!

eduardomelo
Автор

i'm a new student with no development experience searching youtube to solve the quiz. Now, you went through the many different methods to solve it and concluded the best methods were based on what was most clear to read. My question is there also a cost analysis for what is the best method to resolve it as I believe the different memory types are not at the same fee? Now I am sure as I progress through the course that will be answered but at this point progress is really slow as it is starting to get complex so curious to know the answer now. Cheers.

UK_
Автор

Interesting desert you made there.
It resembles some of the issues we had in RISC 30 years ago with regards to RAM/ROM & STACK overflows.

vufberlick
Автор

Hi! Thanks for the explantation!

What happens when you just leave out the data locator? As far I can see, there are three possible cases but I don't know which one is true:
A) Because the type is initialized in state, the location of the variable falls back to storage.
B) Because the variable is initialized within a function, the location of the variable falls back to memory.
C) The code won't compile or throws warnings/errors.

Thanks in advance!

JeromVerschoote
Автор

Tnx for the video. What I don’t understand is where physically in the blockchain is the array of users lives? A block on the blockchain can never be altered, so how can you add users and change their balance?

sanjalon
Автор

Pretty clean explanation and example.
One question, here 6:38, would this solution costs less memory(fees) than declaring a storage var ?

nikolakolchakov
Автор

link in description is missing ;-) can this deal be used if already subsribed to a regular membership?

lars