Skip to main content

SharesLibrary

isLessThanOrEqual

Whether a is less than or equal to b.

function isLessThanOrEqual(Shares a, Shares b) internal pure returns (bool)

Return Values

NameTypeDescription
[0]boolTrue if a <= b, or False if not.

isLessThan

Whether a is less than b.

function isLessThan(Shares a, Shares b) internal pure returns (bool)

isGreaterThanOrEqual

Whether a is greater than or equal to b.

function isGreaterThanOrEqual(Shares a, Shares b) internal pure returns (bool)

isGreaterThan

Whether a is greater than b.

function isGreaterThan(Shares a, Shares b) internal pure returns (bool)

isEqualTo

Whether a is equal to b.

function isEqualTo(Shares a, Shares b) internal pure returns (bool)

isNotEqualTo

Whether a is not equal to b.

function isNotEqualTo(Shares a, Shares b) internal pure returns (bool)

minus

Difference between a and b shares. Reverts if b > a

function minus(Shares a, Shares b) internal pure returns (Shares)

plus

Sum of a and b shares.

function plus(Shares a, Shares b) internal pure returns (Shares)

div

Ratio of a and b shares

function div(Shares a, Shares b) internal pure returns (FPUnsigned)

Return Values

NameTypeDescription
[0]FPUnsignedFPUnsigned ratio of ab\frac{a}{b}. This is not a Shares quantity

divScale

a shares divided by uint b

function divScale(Shares a, uint256 b) internal pure returns (Shares)

Return Values

NameTypeDescription
[0]SharesShares a/b

mul

Shares a times some scaling factor b

function mul(Shares a, FPUnsigned b) internal pure returns (Shares product)

Parameters

NameTypeDescription
aSharesShares quantity
bFPUnsignedFPUnsigned factor

Return Values

NameTypeDescription
productSharesproduct of a*b

rate

Ratio of a per b shares

function rate(uint256 a, Shares b) internal pure returns (PerShare rate_)

Return Values

NameTypeDescription
rate_PerShareab\frac{a}{b} (represented as ba\frac{b}{a})