SafeMath.sol

Git Source

Author: https://github.com/AragonBlack/fundraising/blob/master/apps/bancor-formula/contracts/utility/SafeMath.sol

The sole modification implemented in the contract involves altering the Solidity version number.

Functions

add

returns the sum of _x and _y, reverts if the calculation overflows

function add(uint _x, uint _y) internal pure returns (uint);

Parameters

Name
Type
Description

_x

uint256

value 1

_y

uint256

value 2

Returns

Name
Type
Description

<none>

uint256

sum

sub

returns the difference of _x minus _y, reverts if the calculation underflows

function sub(uint _x, uint _y) internal pure returns (uint);

Parameters

Name
Type
Description

_x

uint256

minuend

_y

uint256

subtrahend

Returns

Name
Type
Description

<none>

uint256

difference

mul

returns the product of multiplying _x by _y, reverts if the calculation overflows

function mul(uint _x, uint _y) internal pure returns (uint);

Parameters

Name
Type
Description

_x

uint256

factor 1

_y

uint256

factor 2

Returns

Name
Type
Description

<none>

uint256

product

div

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

function div(uint _x, uint _y) internal pure returns (uint);

Parameters

Name
Type
Description

_x

uint256

dividend

_y

uint256

divisor

Returns

Name
Type
Description

<none>

uint256

quotient

Last updated