utils

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Unlicense Imports: 15 Imported by: 18

Documentation

Index

Constants

View Source
const (
	// hash长度
	HashLength = 32
	// 地址值长度
	AddressLength = 20
	//合同创建 gas
	TxGasContractCreation uint64 = 53000
	//交易 gas
	TxGas uint64 = 21000
	//交易数据非零gas限制
	TxDataNonZeroGasFrontier uint64 = 68
	//eip2028类型gas限制
	TxDataNonZeroGasEIP2028 uint64 = 16

	TxDataZeroGas uint64 = 4
)

定义hash和地址长度byte

View Source
const (
	CallCreateDepth uint64 = 1024 // 最大深度
	EcrecoverGas    uint64 = 3000 //椭圆曲线算法返回gas价格
)

Variables

View Source
var (
	Big0 = big.NewInt(0)
)

Functions

func CompareMap

func CompareMap(defaultMap map[interface{}]interface{}, newMap map[interface{}]interface{}) map[interface{}]interface{}

func Encode

func Encode(b []byte) string

Encode将b编码为前缀为0x的十六进制字符串。

func GetColorStr

func GetColorStr(color string, isHighLighted bool, str string) string

func GetInToStr

func GetInToStr(value interface{}) string

func GetRandomStr

func GetRandomStr(num int) string

func ReadFileLine

func ReadFileLine(path string) []string

func ReadYaml

func ReadYaml(path string) map[interface{}]interface{}

func ScheduleTask

func ScheduleTask()

func SetTime

func SetTime(hour, min, second int) (d time.Duration)

func WriteFileLine

func WriteFileLine(path string, str string)

Types

type Address

type Address [AddressLength]byte

定义地址字节类型

func BytesToAddress

func BytesToAddress(b []byte) Address

BytesToAddress返回值为b的地址。

func (*Address) SetBytes

func (a *Address) SetBytes(b []byte)

type Hash

type Hash [HashLength]byte

定义hash字节类型

func (Hash) Hex

func (h Hash) Hex() string

十六进制将哈希转换为十六进制字符串。

type Jobs

type Jobs interface {
	Close()
	Execute()
}

type OpCode

type OpCode byte

虚拟机操作码

const (
	STOP OpCode = 0o0
)

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool(max int) *Pool

func (*Pool) Close

func (p *Pool) Close()

关闭池

func (*Pool) PutJobs

func (p *Pool) PutJobs(d Jobs)

将连接返回池中

func (*Pool) Start

func (p *Pool) Start()

Jump to

Keyboard shortcuts

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