* Update to ganache-cli v6.1.0 and truffle v4.1.0 * Update to stable version of ganache-cli * fix: update event emission warning - Fix event emission warnings for solidity 4.21 after truffle has been updated to use this version * fix pr review comments * update to truffle v4.1.5 * update package-lock * add additional emit keywords * update solidity-coverage to 0.4.15 * update to solium 1.1.6 * fix MerkleProof coverage analysis by testing through wrapper * change version pragma to ^0.4.21 * fix solium linting errors
49 lines
1.1 KiB
Solidity
49 lines
1.1 KiB
Solidity
pragma solidity ^0.4.21;
|
|
|
|
|
|
/**
|
|
* @title SafeMath
|
|
* @dev Math operations with safety checks that throw on error
|
|
*/
|
|
library SafeMath {
|
|
|
|
/**
|
|
* @dev Multiplies two numbers, throws on overflow.
|
|
*/
|
|
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
if (a == 0) {
|
|
return 0;
|
|
}
|
|
uint256 c = a * b;
|
|
assert(c / a == b);
|
|
return c;
|
|
}
|
|
|
|
/**
|
|
* @dev Integer division of two numbers, truncating the quotient.
|
|
*/
|
|
function div(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
// assert(b > 0); // Solidity automatically throws when dividing by 0
|
|
// uint256 c = a / b;
|
|
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
|
|
return a / b;
|
|
}
|
|
|
|
/**
|
|
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
|
|
*/
|
|
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
assert(b <= a);
|
|
return a - b;
|
|
}
|
|
|
|
/**
|
|
* @dev Adds two numbers, throws on overflow.
|
|
*/
|
|
function add(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
uint256 c = a + b;
|
|
assert(c >= a);
|
|
return c;
|
|
}
|
|
}
|