Documentation ¶
Index ¶
- Constants
- func GetB16Hash(data []byte) string
- func GetEnvOrDefault(name string, defaultValue string) string
- func GetEnvOrFatal(name string) string
- func GetWorkerId() string
- func MaybeRatToFloat(rat *big.Rat) float64
- func PickEnvOrFatal(envName string) (variable string)
- func RandomIntegers(amount int, min, max uint32) (numbers []uint32)
- func RandomString(length int) string
- func UintMin(left, right int) int
- func UnixStringToTime(unixString string) (*time.Time, error)
- type TokenDetailsBase
Constants ¶
const Context = "UTIL"
Context to use when logging
Variables ¶
This section is empty.
Functions ¶
func GetB16Hash ¶
GetB16Hash returns the sha1 hash of the byte array encoded to base16
func GetEnvOrDefault ¶
GetEnvOrDefault returns the env if it is set, otherwise the default value
func GetEnvOrFatal ¶
GetEnvOrFatal if the env is not set or set to an empty string
func MaybeRatToFloat ¶
converts a big.Rat to a float, returning 0 if the rat is nil
func PickEnvOrFatal ¶
PickEnvOrFatal from a list of inputs provided separated by , - picking one at random each time
func RandomIntegers ¶
generateRandomIntegers gated between min and max, inclusive on both ends, doing some coercion internally to use crypto/rand and assuming that the uint32 requirement in the arguments prevent any size-of-int issues
func RandomString ¶
RandomString generated by creating a buffer of length / 2, filling it up with randomness then returning the base16 encoded form of it.
Types ¶
type TokenDetailsBase ¶
type TokenDetailsBase struct { TokenAddress string TokenDecimals *big.Rat TokenName string // Extras is anything off to the right, in it's string format. Extras []string }
TokenDetailsBase for the minimum token information, used currently by microservice-common-count-wins. TokenDecimals is in its exponential form (ie, 1e18)
func GetTokensListBase ¶
func GetTokensListBase(tokensList_ string) []TokenDetailsBase
GetTokensListBase starting with the address, token name and decimals
func NewTokenDetailsBase ¶
func NewTokenDetailsBase(address, name string, decimals int, extras ...string) TokenDetailsBase
NewTokenDetailsBase with the name and number to turn into an exponential number (ie if given 10, will go 1e10)