Questions tagged [storage-pointer]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers

OpenZippelin upgradeability pattern | How can both implementation and proxy contracts share the same storage tho they were implemented independently?

Please bear with me in this. I tried to understand it myself, but I couldn't. I'm playing the Ethernaut challenges(a series of contracts hacking), and I'm solving the challenge 24 - Puzzle Wallet- ...
0 votes
1 answer

Do keys in a map also packed to storage as well?

If we have this mapping mapping(uint128 => uint256) private first; mapping(uint128 => uint256) private second; Do the keys of uint128 from both first and second gets stored together in one ...
Ric's user avatar
  • 1
0 votes
1 answer

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

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
1 vote
1 answer

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
  • 21
0 votes
1 answer

Local variables in solidity

I have a couple of questions regarding local variables and creating structs and arrays. As I understand they can be stored in memory and in storage. If they defined as state variables they will be ...
Alex's user avatar
  • 3
1 vote
0 answers

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

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
0 votes
1 answer

Solidity Storage Pointers

contract X{ uint256 public x=2; uint256[] public array= [9,8]; function X(){} function getLength() public constant returns(uint256){ return array.length; } ...
ege126's user avatar
  • 3
0 votes
1 answer

Using storage in constructor allows contract to access previously allocated slot

Contract 1: donation timestamp and etherAmount are allocated 2nd and 3rd slots when donation struct is declared outside the constructor. pragma solidity ^0.4.21; contract DonationChallenge { ...
lakhan dhingra's user avatar
2 votes
2 answers

Are storage values copied or referenced?

Given this contract contract C { struct Product { uint price } Product[] storage products; function doSomething() { products.push(Product({price: 100})); products.push(...
Luke Hutchison's user avatar
1 vote
0 answers

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
4 votes
1 answer

Bytes variables are connected

Why are these variables confounding? The returned result shows that both loops are effecting both bytes variables (second returns the same result). function mix() public returns (bytes) { ...
0TTT0's user avatar
  • 662
1 vote
1 answer

What is cheapest way of creating clone of existing smart contract's

I do need to deploy a lot of similar smart contracts. With Solidity it's quite easy, but expensive :( I'm doing: contract One { ... } contract Builder { function create(uint8 amount) public ...
Jaro's user avatar
  • 111
4 votes
2 answers

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.3k