Skip to content

Latest commit

 

History

History
214 lines (182 loc) · 6.16 KB

SafeMath.md

File metadata and controls

214 lines (182 loc) · 6.16 KB

SafeMath (SafeMath.sol)

View Source: contracts/math/SafeMath.sol

SafeMath

Math operations with safety checks that revert on error

Functions

mul

Multiplies two numbers, reverts on overflow.

function mul(uint256 a, uint256 b) internal
returns(uint256)

Arguments

Name Type Description
a uint256
b uint256

div

Integer division of two numbers truncating the quotient, reverts on division by zero.

function div(uint256 a, uint256 b) internal
returns(uint256)

Arguments

Name Type Description
a uint256
b uint256

sub

Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).

function sub(uint256 a, uint256 b) internal
returns(uint256)

Arguments

Name Type Description
a uint256
b uint256

add

Adds two numbers, reverts on overflow.

function add(uint256 a, uint256 b) internal
returns(uint256)

Arguments

Name Type Description
a uint256
b uint256

mod

Divides two numbers and returns the remainder (unsigned integer modulo), reverts when dividing by zero.

function mod(uint256 a, uint256 b) internal
returns(uint256)

Arguments

Name Type Description
a uint256
b uint256

Contracts