...by Daniel Szego
quote
"On a long enough timeline we will all become Satoshi Nakamoto.."
Daniel Szego

Saturday, January 13, 2018

Solidity and Truffle Tips and Tricks - modifiers with parameters


Modifiers could have parameters as well combined for instance with the input values of a function, it is pretty cool isn't is ? As an example, the following code fragments defined a modifier that can ensure that one of the input parameters is bigger than 10. 

 modifier biggerThanTen(uint param){
   require(param > 10);
   _;
 }
    
 function test(uint _input)  biggerThanTen(_input){
   ...
 }