utils

package
v0.0.0-...-a287f25 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HashLength is the expected length of the hash
	HashLength = 32
)

Variables

This section is empty.

Functions

func Bytes2Hex

func Bytes2Hex(bytes []byte) string

func Bytes2HexP

func Bytes2HexP(bytes []byte) string

with prefix '0x'

func HasTheSameSign

func HasTheSameSign(x, y decimal.Decimal) bool

func Hex2Bytes

func Hex2Bytes(str string) ([]byte, error)

func MustDecimalToBigInt

func MustDecimalToBigInt(d decimal.Decimal) *big.Int

func SplitAmount

func SplitAmount(position, amount decimal.Decimal) (close, open decimal.Decimal)

func String2BigInt

func String2BigInt(str string) (*big.Int, error)

func StringToDecimal

func StringToDecimal(str string) (decimal.Decimal, error)

func ToGwei

func ToGwei(n decimal.Decimal) decimal.Decimal

func ToRate

func ToRate(n decimal.Decimal) decimal.Decimal

func ToWad

func ToWad(n decimal.Decimal) decimal.Decimal

Types

type Hash

type Hash [HashLength]byte

func BytesToHash

func BytesToHash(b []byte) Hash

func HexToHash

func HexToHash(s string) (Hash, error)

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (*Hash) SetBytes

func (h *Hash) SetBytes(b []byte)

Jump to

Keyboard shortcuts

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