unshETHZap - Dependencies
SafeMath.sol
The SafeMath.sol is a utility library that provides methods for safely performing arithmetic operations in Solidity. It prevents integer overflow and underflow, which could lead to unexpected behavior in smart contracts. As Solidity's inbuilt arithmetic operations wrap on overflow and underflow, SafeMath provides a safer alternative by reverting the transaction when an operation overflows or underflows. It provides methods for addition, subtraction, multiplication, division, and modulus operations.
SafeMath
A library providing safe arithmetic operations to prevent integer overflow and underflow.
add
function add(uint256 a, uint256 b) internal pure returns (uint256)
Returns the addition of two unsigned integers, reverting on overflow.
Parameters
- a uint256: First number to add.
- b uint256: Second number to add.
Return Values
- uint256: The result of the addition.
Errors
- SafeMath: addition overflow: Raised when the addition operation results in an overflow.
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256)
Returns the subtraction of two unsigned integers, reverting on overflow.
Parameters
- a uint256: The number to subtract from.
- b uint256: The number to subtract.
Return Values
- uint256: The result of the subtraction.
Errors
- SafeMath: subtraction overflow: Raised when the subtraction operation results in an overflow.
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256)
Returns the multiplication of two unsigned integers, reverting on overflow.
Parameters
- a uint256: First number to multiply.
- b uint256: Second number to multiply.
Return Values
- uint256: The result of the multiplication.
Errors
- SafeMath: multiplication overflow: Raised when the multiplication operation results in an overflow.
div
function div(uint256 a, uint256 b) internal pure returns (uint256)
Returns the integer division of two unsigned integers, reverting on division by zero.
Parameters
- a uint256: The dividend.
- b uint256: The divisor.
Return Values
- uint256: The result of the division.
Errors
- SafeMath: division by zero: Raised when the division operation is attempted with zero as divisor.
mod
function mod(uint256 a, uint256 b) internal pure returns (uint256)
Returns the remainder of dividing two unsigned integers, reverting when dividing by zero.
Parameters
- a uint256: The dividend.
- b uint256: The divisor.
Return Values
- uint256: The remainder of the division.
Errors
- SafeMath: modulo by zero: Raised when the modulo operation is attempted with zero as divisor.