Skip to main content

SafeMath

Table of contents

Constructors

Methods

Constructors

constructor

new SafeMath(): SafeMath

Returns

SafeMath

Methods

add

add(a, b): u64

Parameters

NameType
au64
bu64

Returns

u64

Returns the addition of two unsigned integers, reverting on overflow.

Defined in

assembly/libraries/SafeMath.ts:11


div

div(a, b): u64

Parameters

NameType
au64
bu64

Returns

u64

Returns the integer division of two unsigned integers. Reverts on division by zero. The result is rounded towards zero.

Defined in

assembly/libraries/SafeMath.ts:57


mod

mod(a, b): u64

Parameters

NameType
au64
bu64

Returns

u64

Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts with custom message when dividing by zero.

Defined in

assembly/libraries/SafeMath.ts:71


mul

mul(a, b): u64

Parameters

NameType
au64
bu64

Returns

u64

Returns the multiplication of two unsigned integers, reverting on overflow.

Defined in

assembly/libraries/SafeMath.ts:39


sub

sub(a, b): u64

Parameters

NameType
au64
bu64

Returns

u64

Returns the integer division of two unsigned integers. Reverts with custom message on division by zero. The result is rounded towards zero.

Defined in

assembly/libraries/SafeMath.ts:25