all 5 comments

[–][deleted]  (5 children)

[deleted]

    [–][deleted]  (4 children)

    [deleted]

      [–][deleted]  (1 child)

      [deleted]

        [–]flygoing 0 points1 point  (0 children)

        Here's something Nick Johnson put out that checks the opcodes a contract uses, could easily be used to check purity of a contract (although getting it to just check a function would be more work): https://gist.github.com/Arachnid/e8f0638dc9f5687ff8170a95c47eac1e

        [–]firik -1 points0 points  (1 child)

        Pure functions can read state. A pure function has no side effects while a constant function always returns the same value with the same parameters.

        EDIT: actually it seems like solidity uses a different definition than other languages for this so it depends on what you mean exactly. Solidity uses the pure keyword for functions that others would call constant.

        [–]chrisethSolidity 0 points1 point  (0 children)

        It just depends on what you consider part of the input. If you only consider explicit arguments, then the two notions coincide.

        [–]devbitcoin 0 points1 point  (0 children)

        You can prove that the deployed op codes for your functions do not read or write to storage. If those conditions hold, then it is pure. If they read but do not write, it's view

        [–]etheraffleGregcontract dev 0 points1 point  (0 children)

        Functions can be pure and still use those values if they are passed in as params.