Hello everyone. In one function, I was forced to declare a variable with the memory type storage (since there is mapping inside the struct). Is it much more expensive than memory? Does it make sense to remove mapping from struct?

Jul 18, 2021, 8:58 AM
Well, you cannot return the whole struct if you want because it's not possible. You can go for an array instead
Jul 18, 2021, 9:03 AM
I mean, I can't even read it by specifying the storage type?
Jul 18, 2021, 9:09 AM
Can you help me also
Its a small thing l
Jul 18, 2021, 9:13 AM
mapping (uint256 /* index */ => anything)
better than array
Jul 18, 2021, 9:37 AM
Storage will cost much more than memory as the changes made will be permanent. And by the looks of your code, it would be better to remove the mapping inside struct
Jul 18, 2021, 10:05 AM

© 2024 Draquery.com All rights reserved.