Skip to content

Instantly share code, notes, and snippets.

@rmlopes
Last active January 4, 2019 10:20
Show Gist options
  • Save rmlopes/adb0f82e7db6540801e9683e494dc09c to your computer and use it in GitHub Desktop.
Save rmlopes/adb0f82e7db6540801e9683e494dc09c to your computer and use it in GitHub Desktop.
Simple storage function for Solidity v0.5, with modifier
pragma solidity ^0.5.0;
contract MyContract {
uint public mynumber;
/* Modified simple storage function. Only stores numbers greater than 10. */
modifier checkValue(uint mynum){
require(mynum > 10);
_;
}
constructor() public{
mynumber = 24;
}
function storeNum(uint mynum)
public
checkValue(mynum)
{
mynumber = mynum;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment