Questions tagged [storage-pointer]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
446 views

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) { ...
user avatar
  • 583
3 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 ...
user avatar
  • 9,177
2 votes
2 answers
138 views

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(...
user avatar
1 vote
1 answer
1k views

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 ...
user avatar
  • 111
1 vote
0 answers
49 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 ...
user avatar
1 vote
0 answers
65 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 ...
user avatar
  • 170
0 votes
1 answer
52 views

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; } ...
user avatar
  • 3
0 votes
0 answers
56 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 ...
user avatar
0 votes
1 answer
39 views

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 { ...
user avatar