LSDVault - Dependencies
SafeMath.sol
The SafeMath library is a collection of functions that are designed to handle arithmetic operations in Solidity safely. Solidity's arithmetic operations wrap on overflow, which can result in bugs. The SafeMath library counters this by reverting the transaction when an operation overflows. It provides functions for addition, subtraction, multiplication, division, and modulo operations. It's recommended to use this library for arithmetic operations in Solidity to prevent bugs related to overflows.
A library for safe arithmetic operations in Solidity.
function add(uint256 a, uint256 b) internal pure returns (uint256)
Returns the addition of two unsigned integers, reverting on overflow.
a
uint256
: First number to add.b
uint256
: Second number to add.uint256
: Result of the addition.SafeMath: addition overflow: Thrown if the addition operation overflows.
function sub(uint256 a, uint256 b) internal pure returns (uint256)
Returns the subtraction of two unsigned integers, reverting on overflow.
a
uint256
: Number from which to subtract.b
uint256
: Number to subtract.uint256
: Result of the subtraction.SafeMath: subtraction overflow: Thrown if the subtraction operation overflows.
function mul(uint256 a, uint256 b) internal pure returns (uint256)
Returns the multiplication of two unsigned integers, reverting on overflow.
a
uint256
: First number to multiply.b
uint256
: Second number to multiply.uint256
: Result of the multiplication.SafeMath: multiplication overflow: Thrown if the multiplication operation overflows.
function div(uint256 a, uint256 b) internal pure returns (uint256)
Returns the integer division of two unsigned integers. Reverts on division by zero.
a
uint256
: Number to divide.b
uint256
: Number to divide by.uint256
: Result of the division.SafeMath: division by zero: Thrown if the divisor is zero.
function mod(uint256 a, uint256 b) internal pure returns (uint256)
Returns the remainder of dividing two unsigned integers. Reverts when dividing by zero.
a
uint256
: Number for which to find the remainder.b
uint256
: Number to divide by.uint256
: Remainder of the division.SafeMath: modulo by zero: Thrown if the divisor is zero.