conv

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressToBigInt

func AddressToBigInt(addr common.Address) big.Int

func PrettyBlockNumberWithUnderscores

func PrettyBlockNumberWithUnderscores(blockNumber uint64) string

PrettyBlockNumberWithUnderscores pretty prints a block number e.g. 16345454 as 16_345_454

func PrettyShortenAddress

func PrettyShortenAddress(addr string) string

PrettyShortenAddress takes an address like 0xdA6c517C4ed4134E5Ae1f825d028559f267767df and returns 0xdA6c...df

func PrettyTrimAddress

func PrettyTrimAddress(addr common.Address) (trimmed string)

PrettyTrimAddress removes leading zeros in address

func SafeBigIntToFloat

func SafeBigIntToFloat(n *big.Int) float64

SafeBigIntToFloat converts a big.Int to a float or zero if any troubles

func SafeScaleTokenValue

func SafeScaleTokenValue(tokenValue *big.Int, decimals int) (resultFloat float64)

SafeScaleTokenValue scales a token value by the given decimals and returns the value with two decimal places afterwards. So 123456789 and 6 decimals will return 123.46 (which is 123.456789 rounded up to 123.46). If anything goes wrong the expected will be 0.00.

func SafeStringToInt

func SafeStringToInt(s string) int

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL