Skip to content

Commit 896c3e3

Browse files
Update SafeMath.sol
1 parent 4df6724 commit 896c3e3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

SafeMath.sol

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity >=0.7.0 <0.8.0;
33

4+
/**
5+
* @dev Wrappers over Solidity's arithmetic operations with added overflow
6+
* checks.
7+
*
8+
* Arithmetic operations in Solidity wrap on overflow. This can easily result
9+
* in bugs, because programmers usually assume that an overflow raises an
10+
* error, which is the standard behavior in high level programming languages.
11+
* `SafeMath` restores this intuition by reverting the transaction when an
12+
* operation overflows.
13+
*
14+
* Using this library instead of the unchecked operations eliminates an entire
15+
* class of bugs, so it's recommended to use it always.
16+
*/
17+
418
library SafeMath {
519
function safeAdd(uint a, uint b) internal pure returns (uint c) {
620
c = a + b;

0 commit comments

Comments
 (0)