Last active
September 21, 2019 09:09
-
-
Save MajdT51/190a0b67847a4bff80d3a3124df91efe to your computer and use it in GitHub Desktop.
SafeMath library example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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