Questions tagged [storage-pointer]
The storage-pointer tag has no usage guidance.
15
questions
1
vote
2
answers
157
views
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
88
views
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 ...
0
votes
1
answer
44
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[] ...
0
votes
0
answers
86
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'...
1
vote
1
answer
66
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;
...
0
votes
1
answer
235
views
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 ...
1
vote
0
answers
448
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
...
1
vote
0
answers
499
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 ...
0
votes
1
answer
373
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;
}
...
0
votes
1
answer
137
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 {
...
2
votes
2
answers
155
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(...
1
vote
0
answers
171
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 ...
4
votes
1
answer
597
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) {
...
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 ...
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 ...