Skip to content

Instantly share code, notes, and snippets.

@MajdT51
Last active September 21, 2019 09:09
Show Gist options
  • Save MajdT51/190a0b67847a4bff80d3a3124df91efe to your computer and use it in GitHub Desktop.
Save MajdT51/190a0b67847a4bff80d3a3124df91efe to your computer and use it in GitHub Desktop.
SafeMath library example
pragma solidity >= 0.4.25 < 0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) public pure returns (uint256){
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment