Questions tagged [storage-pointer]

The tag has no usage guidance.

7 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
2 answers
2k views

Declaring a memory array of storage pointers in Solidity

I would like to declare a variable as a memory array of pointers to storage arrays of uint256. For example: pragma solidity ^0.4.24; contract A { uint256[] public array0; uint256[] public ...
Jesbus's user avatar
  • 10.5k
2 votes
0 answers
564 views

Copying strings and bytes from memory to storage via storage references

What's the proper way to copy a string (or bytes) from memory to storage? When copied directly into a state variable lvalue (or into a mapping), there's no problem, but when assigning a string memory ...
Duncan Townsend's user avatar
1 vote
1 answer
67 views

Unable to reach storage struct via mapping

Gm, I've got a smart contract for 2D board game purposes. There is a struct Unit struct Unit { UnitType unitType; uint16 x; uint16 y; int8 hp; int8 dmg; ...
Ghinter's user avatar
  • 31
1 vote
0 answers
488 views

Retrieve Storage Variable Name given Storage Location and Contract Source

Is there any easy way to get the storage variable names provided you have the source code and the storage locations of the variables for a contract? For example, for the following contract I can use ...
Travis Carpenter's user avatar
1 vote
0 answers
176 views

Mappings with (multiple) pointers to structs

I need to store some datasets as structs in mappings, that should be accessible via multiple keys. Obviously, I dont want to store the same dataset multiple times, so I want to have one copy in memory ...
Xenonite's user avatar
  • 214
0 votes
1 answer
47 views

Changing storage ref to storage pointer

In the function registerUser below, I am trying to access a global array of structs, and seeing if the argument I have passed exists in the global array or not. The code is as follows: user_details[] ...
Dhairya Khale's user avatar
0 votes
0 answers
119 views

Do contract storage locations that map wallet address to balance change

Will the storage location of a wallet address' balance change over time? If so, is it a problem largely associated with edge cases/unimportant tokens or is it a pervasive risk? For some background: I'...
itgav's user avatar
  • 26