Documentation
¶
Index ¶
- func Abs[V constraints.Signed](val V) V
- func BigFloatToBigInt(f *big.Float, decimals uint64) *big.Int
- func CalculateMedian(values []*big.Float) *big.Float
- func Float64StringToBigFloat(s string) (*big.Float, error)
- func Float64StringToBigInt(s string, decimals uint64) (*big.Int, error)
- func Float64ToBigInt(val float64, decimals uint64) *big.Int
- func GetScalingFactor(first, second int64) *big.Float
- func Max[V int | int64 | uint64 | int32 | uint32](vals ...V) V
- func Min[V int | int64 | uint64 | int32 | uint32](vals ...V) V
- func ScaleBigFloat(f *big.Float, decimals uint64) *big.Float
- func SortBigFloats(values []*big.Float)
- func VerifyPrice(t *testing.T, expected, actual *big.Int, acceptableDelta float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
func Abs[V constraints.Signed](val V) V
Abs returns the absolute value of a given number.
func BigFloatToBigInt ¶
BigFloatToBigInt converts a big.Float to a big.Int.
func CalculateMedian ¶
CalculateMedian calculates the median from a list of big.Float. Returns an average if the number of values is even.
func Float64StringToBigFloat ¶
Float64StringToBigFloat converts a float64 string to a big.Float.
func Float64StringToBigInt ¶
Float64StringToBigInt converts a float64 string to a big.Int.
func Float64ToBigInt ¶
Float64ToBigInt converts a float64 to a big.Int.
func GetScalingFactor ¶
GetScalingFactor returns the scaling factor for the price based on the difference between the token decimals in the erc20 token contracts or similar.
func ScaleBigFloat ¶
ScaleBigFloat scales a big.Float by the given decimals.
func SortBigFloats ¶
SortBigFloats is a stable slices sort for an array of big.Floats.
Types ¶
This section is empty.