Questions tagged [pure]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
48 views

Standard work-around for using a Solidity constant array (which is not supported) in pure function?

I have an array in my contract like this and a pure method which uses it like this (simplified exmaple because my real exmaple is many more lines): uint[16] constant x = [10, 2, 6, 42, 19, 5, 4, 36, ...
2
votes
2answers
150 views

Pure functions as a replacement of constant mappings?

I need to create a lookup table [uint -> uint] that is constant. Constant mappings or switch-case are not available in solidity. Are pure functions full of if-else the only option? Any better ...
0
votes
3answers
319 views

Gas cost call vs send for pure/view functions

I'm aware of the fact that pure/view functions cost no gas with a simple "call". But what happens if i have a function that changes the contract state based on the pure/view function result. Do i have ...
1
vote
1answer
75 views

What happens if view function calls function that is neither 'view' nor 'pure'?

currently view is not enforced. Calling a function that is neither 'view' nor 'pure' from within a function that is causes a warning, but compiles. My question is what is the result from externally ...
1
vote
1answer
109 views

Pure function execution flow

We're working with the project in which we're storing some confidential details (different for each user)in smart contract, we don't want to show this information to anyone else even miner, thus we ...
5
votes
2answers
1k views

View/Pure Gas usage - Cost gas if called internally by another function?

I know similar questions have been asked before however I could not find an good explanation for the following, In one of the tutorial it says: Pure and View functions don't cost any gas to call ...
27
votes
4answers
19k views

When to use “View” and “Pure” in place of “Constant” [duplicate]

According to the solidity 0.4.17 Release Notes this release finally checks the modifiers view (used to be named constant) and pure on functions. As a rule of thumb, use view if your function ...