Skip to content

Latest commit

 

History

History
194 lines (139 loc) · 3.88 KB

StableMath.md

File metadata and controls

194 lines (139 loc) · 3.88 KB

StableMath (StableMath.sol)

View Source: contracts/StableMath.sol

StableMath

Accesses the Stable Math library using generic system wide variables for managing precision Derives from OpenZeppelin's SafeMath lib

Contract Members

Constants & Variables

uint256 private constant fullScale;

Functions

getScale

Getters

function getScale() internal pure
returns(uint256)

Arguments

Name Type Description

scale

Scaled a given integer to the power of the full scale.

function scale(uint256 a) internal pure
returns(b uint256)

Arguments

Name Type Description
a uint256

add

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

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

Arguments

Name Type Description
a uint256
b uint256

sub

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

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

Arguments

Name Type Description
a uint256
b uint256

mul

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

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

Arguments

Name Type Description
a uint256
b uint256

mulTruncate

Multiplies two numbers and truncates

function mulTruncate(uint256 a, uint256 b, uint256 _scale) internal pure
returns(c uint256)

Arguments

Name Type Description
a uint256
b uint256
_scale uint256

mulTruncate

Multiplies two numbers and truncates using standard full scale

function mulTruncate(uint256 a, uint256 b) internal pure
returns(c uint256)

Arguments

Name Type Description
a uint256
b uint256

div

Returns the integer division of two unsigned integers

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

Arguments

Name Type Description
a uint256
b uint256

divPrecisely

Precisely divides two numbers, first by expanding

function divPrecisely(uint256 a, uint256 b) internal pure
returns(c uint256)

Arguments

Name Type Description
a uint256
b uint256

Contracts