Class: Density
Utility wrapper around raw Density values from Mangrove.
Constructorsβ
constructorβ
β’ new Density(rawDensity
, outboundDecimals
): Density
Construct a wrapper around a raw Density from Mangrove.
Parametersβ
Name | Type | Description |
---|---|---|
rawDensity | BigNumberish | A raw Density from Mangrove |
outboundDecimals | number | number of decimals for the outbound token |
Returnsβ
Defined inβ
@mangrovedao/mangrove.js/src/util/Density.ts:20
Methodsβ
cloneβ
βΈ clone(): Density
Create a copy of this Density object.
Returnsβ
Defined inβ
@mangrovedao/mangrove.js/src/util/Density.ts:29
from96X32β
βΈ from96X32(density96X32
, outbound_decimals
): Density
Factory method for creating a Density object from a 96X32 density.
Parametersβ
Name | Type | Description |
---|---|---|
density96X32 | BigNumberish | density encoded as a 96X32 |
outbound_decimals | number | number of decimals for the outbound token |
Returnsβ
a Density object corresponding to the given density
Defined inβ
@mangrovedao/mangrove.js/src/util/Density.ts:40
eqβ
βΈ eq(density
): boolean
Equality comparison for densities.
Parametersβ
Name | Type | Description |
---|---|---|
density | Density | The density to compare to |
Returnsβ
boolean
true if the given density is equal to this density; false otherwise
Defined inβ
@mangrovedao/mangrove.js/src/util/Density.ts:56
toStringβ
βΈ toString(): string
Format the density formatted as a string.
Returnsβ
string
the density formatted as a 'mantissa * 2^exponent' string
Defined inβ
@mangrovedao/mangrove.js/src/util/Density.ts:68
toStringβ
βΈ toString(rawDensity
): string
Format the density formatted as a string.
Parametersβ
Name | Type | Description |
---|---|---|
rawDensity | BigNumberish | the raw density to format |
Returnsβ
string
the density formatted as a 'mantissa * 2^exponent' string
Defined inβ
@mangrovedao/mangrove.js/src/util/Density.ts:78
isZeroβ
βΈ isZero(): boolean
Check whether the density is zero.
Returnsβ
boolean
true if the density is zero; false otherwise
Defined inβ
@mangrovedao/mangrove.js/src/util/Density.ts:108
getRequiredOutboundForGasreqβ
βΈ getRequiredOutboundForGasreq(gasreq
): Big
Get the minimum amount of outbound tokens required for the given amount of gas.
Parametersβ
Name | Type | Description |
---|---|---|
gasreq | BigNumberish | the amount of gas to calculate the required outbound for |
Returnsβ
Big
the minimum amount of outbound tokens required for the given amount of gas
Defined inβ
@mangrovedao/mangrove.js/src/util/Density.ts:118
getMaximumGasForRawOutboundβ
βΈ getMaximumGasForRawOutbound(rawOutboundAmt
): BigNumber
Get the maximum amount of gas an offer may require for the given raw amount of outbound tokens.
Parametersβ
Name | Type | Description |
---|---|---|
rawOutboundAmt | BigNumberish | the raw amount of outbound tokens to calculate the maximum gas for |
Returnsβ
BigNumber
the maximum amount of gas an offer may require for the given raw amount of outbound tokens
Defined inβ
@mangrovedao/mangrove.js/src/util/Density.ts:133