SharesLibrary
isLessThanOrEqual
Whether a is less than or equal to b.
function isLessThanOrEqual(Shares a, Shares b) internal pure returns (bool)
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | True 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
| Name | Type | Description |
|---|---|---|
| [0] | FPUnsigned | FPUnsigned ratio of . 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
| Name | Type | Description |
|---|---|---|
| [0] | Shares | Shares a/b |
mul
Shares a times some scaling factor b
function mul(Shares a, FPUnsigned b) internal pure returns (Shares product)
Parameters
| Name | Type | Description |
|---|---|---|
a | Shares | Shares quantity |
b | FPUnsigned | FPUnsigned factor |
Return Values
| Name | Type | Description |
|---|---|---|
product | Shares | product of a*b |
rate
Ratio of a per b shares
function rate(uint256 a, Shares b) internal pure returns (PerShare rate_)
Return Values
| Name | Type | Description |
|---|---|---|
rate_ | PerShare | (represented as ) |