utils

package
v1.67.4 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: BSD-3-Clause Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Addr2DecimalsKey = []byte("prefix_for_Addr2Decimals")
)

Addr2DecimalsKey ...

View Source
var Decimal2value = map[int]int64{
	1:  1e1,
	2:  1e2,
	3:  1e3,
	4:  1e4,
	5:  1e5,
	6:  1e6,
	7:  1e7,
	8:  1e8,
	9:  1e9,
	10: 1e10,
	11: 1e11,
}

Functions

func Address

func Address(input interface{}) []byte

Address address

func AddressArray

func AddressArray(input interface{}) []byte

AddressArray address

func Bool

func Bool(input interface{}) []byte

Bool bool

func BoolArray

func BoolArray(input interface{}) []byte

BoolArray bool array

func Bytes16

func Bytes16(input interface{}) []byte

Bytes16 bytes16

func Bytes32

func Bytes32(input interface{}) []byte

Bytes32 bytes32

func CalAddr2DecimalsPrefix

func CalAddr2DecimalsPrefix(tokenAddr string) []byte

CalAddr2DecimalsPrefix ...

func CheckPower

func CheckPower(power int64) bool

CheckPower ...

func ConcatByteSlices

func ConcatByteSlices(arrays ...[]byte) []byte

ConcatByteSlices concat byte slices

func DivideDot

func DivideDot(in string) (left, right string, err error)

DivideDot ...

func GetDecimalsFromDB

func GetDecimalsFromDB(addr string, db dbm.DB) (int64, error)

GetDecimalsFromDB ...

func GetDecimalsFromNode

func GetDecimalsFromNode(addr, rpcLaddr string) (int64, error)

GetDecimalsFromNode ...

func Int128

func Int128(input interface{}) []byte

Int128 int128

func Int128Array

func Int128Array(input interface{}) []byte

Int128Array int128 array

func Int16

func Int16(input interface{}) []byte

Int16 int16

func Int16Array

func Int16Array(input interface{}) []byte

Int16Array int16 array

func Int256

func Int256(input interface{}) []byte

Int256 int256

func Int256Array

func Int256Array(input interface{}) []byte

Int256Array int256 array

func Int32

func Int32(input interface{}) []byte

Int32 int32

func Int32Array

func Int32Array(input interface{}) []byte

Int32Array int32

func Int64

func Int64(input interface{}) []byte

Int64 int64

func Int64Array

func Int64Array(input interface{}) []byte

Int64Array int64 array

func Int8

func Int8(input interface{}) []byte

Int8 int8

func Int8Array

func Int8Array(input interface{}) []byte

Int8Array int8 array

func IsExecAddrMatch

func IsExecAddrMatch(name string, to string) bool

IsExecAddrMatch ...

func IsValidPassWord

func IsValidPassWord(password string) bool

IsValidPassWord 密码合法性校验,密码长度在8-30位之间。必须是数字+字母的组合

func IsZeroAddress

func IsZeroAddress(address common.Address) bool

IsZeroAddress : checks an Ethereum address and returns a bool which indicates if it is the null address

func LoadInt64FromDB

func LoadInt64FromDB(key []byte, db dbm.DB) (int64, error)

LoadInt64FromDB ...

func MultiplySpecifyTimes

func MultiplySpecifyTimes(start float64, time int64) float64

MultiplySpecifyTimes ...

func Pack

func Pack(types []string, values []interface{}) []byte

Pack ...

func QueryResult added in v1.67.0

func QueryResult(param, abiData, contract, owner string, client ethinterface.EthClientSpec) (string, error)

func QueryTxhashes

func QueryTxhashes(prefix []byte, db dbm.DB) []string

QueryTxhashes ...

func SendToServer added in v1.66.3

func SendToServer(url string, req io.Reader) ([]byte, error)

func SignClaim4Evm

func SignClaim4Evm(hash common.Hash, privateKey *ecdsa.PrivateKey) ([]byte, error)

func SimpleGetDecimals

func SimpleGetDecimals(addr string) (int64, error)

func SmalToBig added in v1.67.0

func SmalToBig(amount float64, decimals uint8) *big.Int

func SoliditySHA3

func SoliditySHA3(data ...interface{}) []byte

SoliditySHA3 solidity sha3

func SoliditySHA3WithPrefix

func SoliditySHA3WithPrefix(data []byte) []byte

SoliditySHA3WithPrefix solidity sha3 with prefix

func String

func String(input interface{}) []byte

String string

func StringArray

func StringArray(input interface{}) []byte

StringArray string

func ToWei

func ToWei(amount float64, decimal int64) *big.Int

ToWei 将eth单位的金额转为wei单位

func Toeth

func Toeth(amount string, decimal int64) float64

Toeth ...

func TrimZeroAndDot

func TrimZeroAndDot(s string) string

TrimZeroAndDot ...

func Uint128

func Uint128(input interface{}) []byte

Uint128 uint128

func Uint128Array

func Uint128Array(input interface{}) []byte

Uint128Array uint128

func Uint16

func Uint16(input interface{}) []byte

Uint16 uint16

func Uint16Array

func Uint16Array(input interface{}) []byte

Uint16Array uint16 array

func Uint256

func Uint256(input interface{}) []byte

Uint256 uint256

func Uint256Array

func Uint256Array(input interface{}) []byte

Uint256Array uint256 array

func Uint32

func Uint32(input interface{}) []byte

Uint32 uint32

func Uint32Array

func Uint32Array(input interface{}) []byte

Uint32Array uint32 array

func Uint64

func Uint64(input interface{}) []byte

Uint64 uint64

func Uint64Array

func Uint64Array(input interface{}) []byte

Uint64Array uint64 array

func Uint8

func Uint8(input interface{}) []byte

Uint8 uint8

func Uint8Array

func Uint8Array(input interface{}) []byte

Uint8Array uint8 array

Types

This section is empty.

Jump to

Keyboard shortcuts

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