|
|
|
@ -51,6 +51,9 @@ library SafeMath { |
|
|
|
|
* |
|
|
|
|
* Requirements: |
|
|
|
|
* - Subtraction cannot overflow. |
|
|
|
|
* |
|
|
|
|
* NOTE: This is a feature of the next version of OpenZeppelin Contracts. |
|
|
|
|
* @dev Get it via `npm install @openzeppelin/contracts@next`. |
|
|
|
|
*/ |
|
|
|
|
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { |
|
|
|
|
require(b <= a, errorMessage); |
|
|
|
@ -107,6 +110,9 @@ library SafeMath { |
|
|
|
|
* |
|
|
|
|
* Requirements: |
|
|
|
|
* - The divisor cannot be zero. |
|
|
|
|
|
|
|
|
|
* NOTE: This is a feature of the next version of OpenZeppelin Contracts. |
|
|
|
|
* @dev Get it via `npm install @openzeppelin/contracts@next`. |
|
|
|
|
*/ |
|
|
|
|
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { |
|
|
|
|
// Solidity only automatically asserts when dividing by 0 |
|
|
|
@ -142,6 +148,9 @@ library SafeMath { |
|
|
|
|
* |
|
|
|
|
* Requirements: |
|
|
|
|
* - The divisor cannot be zero. |
|
|
|
|
* |
|
|
|
|
* NOTE: This is a feature of the next version of OpenZeppelin Contracts. |
|
|
|
|
* @dev Get it via `npm install @openzeppelin/contracts@next`. |
|
|
|
|
*/ |
|
|
|
|
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { |
|
|
|
|
require(b != 0, errorMessage); |
|
|
|
|