utils

package
v0.0.0-...-cd98764 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountFaucetDripped = 1
)

account faucet

Variables

View Source
var (
	ErrInvalidAddress         = errors.New("invalid hex-encoded address")
	ErrSelfSending            = errors.New("not allowed to send to yourself")
	ErrExceedMaxAmount        = errors.New("exceeds the maximum amount")
	ErrNoExistFromAddress     = errors.New("not exist from address")
	ErrTaskStatusNotSubmitted = errors.New("task status is not submitted")
	ErrDBAmount               = errors.New("database amount error")
	ErrStringToBigInt         = errors.New("value convert to big int error")
	ErrNegative               = errors.New("value cannot be negative")
)
View Source
var (
	BigNEW *big.Int = big.NewInt(1e+18) // BigNEW in WEI
)
View Source
var (

	// newton
	// 100,000,000,000 NEW
	NewtonMax = big.NewInt(0).Mul(big.NewInt(100000000000), big1NEWInWEI)
)

Functions

func AddBalance

func AddBalance(xi, xd, yi, yd uint64) (i, d uint64)

func GetAmountISAAC

func GetAmountISAAC(amountStr, unit string) (*big.Int, error)

func GetISAACAmountTextByUnit

func GetISAACAmountTextByUnit(amount *big.Int, unit string) string

GetISAACAmountTextByUnit convert 1000000000 ISAAC to string of 0.000000001 NEW or 1000000000 ISAAC

func GetISAACAmountTextUnitByUnit

func GetISAACAmountTextUnitByUnit(amount *big.Int, unit string) string

func GetNewtonAmountISAAC

func GetNewtonAmountISAAC(amountStr, unit string) (*big.Int, error)

func GetTodayEndUnix

func GetTodayEndUnix() int64

func GetTodayStartUnix

func GetTodayStartUnix() int64

func GetTodayUnix

func GetTodayUnix() int64

func GetTomorrowUnix

func GetTomorrowUnix() int64

func GetYesterdayEndUnix

func GetYesterdayEndUnix() int64

func GetYesterdayStartUnix

func GetYesterdayStartUnix() int64

func GetYesterdayUnix

func GetYesterdayUnix() int64

func MergeBalance

func MergeBalance(i, d uint64) *big.Int

MergeBalance merge balance in interger and fractional into big.Int

func MergeBalanceNEW

func MergeBalanceNEW(i, d uint64) string

MergeBalanceNEW MergeBalanceNEW string

func SplitBalance

func SplitBalance(balance *big.Int) (uint64, uint64)

SplitBalance convert balance to a decimal number in NEW return the integer and fractional parts

func Version

func Version() string

Types

This section is empty.

Jump to

Keyboard shortcuts

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