Skip to main content
Version: testnet (v0.78)

SafeMath (SafeMath.sol)

View Source: contracts/tests/SafeMath.sol

SafeMath

Math operations with safety checks that throw on error

Functions

mul

Multiplies two numbers, throws on overflow.

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

Arguments

NameTypeDescription
auint256
buint256

div

Integer division of two numbers, truncating the quotient.

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

Arguments

NameTypeDescription
auint256
buint256

sub

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

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

Arguments

NameTypeDescription
auint256
buint256

add

Adds two numbers, throws on overflow.

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

Arguments

NameTypeDescription
auint256
buint256