Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [local-variables]

The tag has no usage guidance.

1
vote
0answers
20 views

What's the best way to send many strings in only one call?

So I have to write on-chain about 15 string key-value pairs in one call. Of course, I took the naive approach first by putting all those strings as arguments of my contract, but then I run onto the 16 ...
0
votes
1answer
12 views

Error accesing variables from other solidity file

I get a error when I call to the getVal function inside testToken file. The EVM return me the following: call to testCoin.getVal errored: VM error: revert. revert The transaction has been ...
2
votes
1answer
51 views

Pointing to other contracts in solidity?

I'm doing the CryptoZombies tutorial to get a better handle on solidity and in one of the chapters it contains the following code pragma solidity ^0.4.19; import "./zombiefactory.sol"; contract ...
1
vote
3answers
184 views

value types(uint, bool, etc) as local variable is set to memory initially?

According to this answer, it says simpler variables like bool, uint, et cetera are not variable in length, and are therefore defaulted to memory, whereas this one mentions uint256 v; is default to ...
6
votes
0answers
214 views

Truffle debug on function call show null variables

With a truffle version of 4.1.0, using truffle debug on a call of my contract function below: function Deposit (uint256 timeout, bytes32 hash, address recipient) public payable returns (...
2
votes
1answer
136 views

local var inside a function modifies another state variable

I have this very simple contract: pragma solidity ^0.4.18; contract C{ uint public a = 9; uint[] public data; function f(uint _a) public{ a = _a; uint[] y; ...
2
votes
1answer
70 views

Examples of functions limitations?

I coded different functions and didn't find a standard that define crystal clear how many variables you can use (fields, local or as parameters of modifiers inside this function? Do you know a ...
5
votes
2answers
501 views

Stack too deep | Use memory array to store many “local” variables?

I have a contract that's doing a fairly complex calculation with some intermediate calculations, and I'm running into the "stack too deep" problem. I've tried to use a memory array within the ...
0
votes
0answers
368 views

Truffle: errors when I try to access variables of a ERC20 token contract

I got a few errors when I try to access variables of a ERC20 token contract. The contract is the "Sample fixed supply token contract" from https://theethereum.wiki/w/index.php/ERC20_Token_Standard ...
2
votes
1answer
358 views

State Variable Storage in Contracts

I'm learning Solidity. According to the docs, variables are permanently stored in contract storage. From my understanding (I may be wrong), the details are on the blockchain. My question is, how do I ...
9
votes
2answers
5k views

Local variable and state variable, and the difference between them

I am new to solidity. When I read the solidity documentation, it says local variable and state variable. But I can't find the definition of the two terms. Can anyone explain the meaning of local ...
2
votes
1answer
453 views

Local storage variable

I am reading the solidity docs here and I seem to be struggling to understand the following. Data locations are important because they change how assignments behave: assignments between ...