Questions tagged [state-variable]

The tag has no usage guidance.

14 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
1answer
347 views

What are 'payable' state variables?

https://solidity.readthedocs.io/en/latest/solidity-by-example.html#simple-open-auction pragma solidity ^0.4.22; contract SimpleAuction { address payable public beneficiary; What exactly does ...
2
votes
2answers
106 views

Is Solidity creating an implicit getter for a nested contract that is created?

Is Solidity creating an implicit getter or not for a nested contract that is created? Example: contract Foo { .... } contract Bar { Foo public foo; Bar() { foo = new Foo(); } ...
1
vote
1answer
36 views

Receiving error while getting state variable value after using selfdestruct method “Error: Returned values aren't valid, did it run Out of Gas?”

I am using selfdestruct method and passing the payable address to it but receiving the following error when trying to get the value of a state variable : "Error: Returned values aren't valid, did it ...
1
vote
0answers
32 views

Retrieving a State_object value on go-ethereum

I have a deployed contract address and I need to query a contract storage value, a token account balance that is stored on a mapping variable: mapping (address => uint256) balances; From go-...
1
vote
1answer
51 views

Accessing the Ethereum State Variables using web3js (Java Script)

I'm trying to run the below code to get the state variables using the getIdBytes method of the Smart Contract, and assign it to a java script array variable, but it doesn't seem to work. All I can ...
1
vote
0answers
30 views

Best way to restore historical storage state

What is the best way to get historical storage state, given db with current world state and blockchain data? Do I need to reverse assemby code or can I do this using receipt logs?
1
vote
0answers
74 views

Layout of State Variables in Storage -> specifically NON Statically-sized variables e.g. Mapping

The following page provides information on how to access a contract's state variables, regardless of who the owner is or what methods are exposed. http://solidity.readthedocs.io/en/latest/...
0
votes
0answers
38 views

variables does not accept new values when using _addr.call(abi.encodeWithSignature(…))

Below is a simple contract to reproduce the issue: pragma solidity ^0.6.6; contract A { address internal constant ONE_INCH_ADDRESS = 0xC586BeF4a0992C495Cf22e1aeEE4E446CECDee0E; string v1 = '...
0
votes
0answers
17 views

Maximum Number of State Variables

My Solidity linter warns me if I have more than 15 variables declared, and I got around this by packing multivariable into an array, such as changing unit public x1; unit public x2; into unit[2] ...
0
votes
0answers
38 views

if “address public x = tx.origin”, why does “require (tx.origin == x”) work and "require (tx.origin==tx.origin) not

Below is a contract that i have commented on, hoping to understand the logic of the arguments. Below in bold is the question in question. The .sol currently works fine. pragma solidity ^0.5.11; ...
0
votes
0answers
49 views

Can we issue a token with specific local state?

Will it be possible to create an ERC20-Token, that will be "minted" with specific local state on a per token-basis while this state can change over time through the execution of a method in the smart ...
0
votes
0answers
174 views

How to interact with a smart contract to change a variable state

How do I change a variable in a smartcontract (bool) As requested, a new followup question from the above^ about ethereum smart contracts (solidity) If I have, early in the contract: bool public ...
0
votes
1answer
66 views

Unable to change the length of a global 2D storage array

I am facing difficulties changing the length of a global 2D storage array. It seems to be working correctly on Remix IDE, but when I try to test it on ganache-cli (formerly known as testrpc) - either ...
0
votes
0answers
628 views

totalSupply in ERC20Basic contract is not initialized to zero. Does that matter?

I copied code from TenX, which copied code from OpenZeppelin. TenX and OpenZeppelin has this code for contract ERC20Basic: contract ERC20Basic { uint256 public totalSupply; function balanceOf(...