anonymousvoting icon indicating copy to clipboard operation
anonymousvoting copied to clipboard

Change function modifiers and condition checking instruction

Open chrsow opened this issue 7 years ago • 2 comments

There are two changes in the commit

  1. Use require() and assert() instead of throw for condition checking
  • Since the solidity version from 0.4.10 onwards supports require() and assert(). Those two function will refunds gas in case of an error occurs.

Ref: http://solidity.readthedocs.io/en/develop/control-structures.html#error-handling-assert-require-revert-and-exceptions

  1. Change functions modifiers 'view' and pure instead of constant
  • Version 0.4.17 supports view and pure which has more clear leading word than constant.

Ref: http://solidity.readthedocs.io/en/develop/miscellaneous.html#modifiers

chrsow avatar Jan 08 '18 13:01 chrsow

Hey thanks for doing this! I'll test out the changes (and check everything is working with latest solidity) before committing them

stonecoldpat avatar Jan 11 '18 10:01 stonecoldpat

@chrsow, how did you compile smart contract? Because I also tried to compile in Etherium Wallet and received warning message: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using “switch” or “for” statements instead. jumpi(end, iszero(bit)) ^---^ The same warning for jump assembly command.

fedorloshakov avatar Jan 26 '18 08:01 fedorloshakov