utils

package
v1.5.2-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2018 License: LGPL-3.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

* Copyright (C) 2018 The ontology Authors * This file is part of The ontology library. * * The ontology is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The ontology is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with The ontology. If not, see <http://www.gnu.org/licenses/>.

* Copyright (C) 2018 The ontology Authors * This file is part of The ontology library. * * The ontology is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The ontology is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with The ontology. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	BYTE_FALSE = []byte{0}
	BYTE_TRUE  = []byte{1}

	OntContractAddress, _        = common.AddressParseFromBytes([]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01})
	OngContractAddress, _        = common.AddressParseFromBytes([]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02})
	OntIDContractAddress, _      = common.AddressParseFromBytes([]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03})
	ParamContractAddress, _      = common.AddressParseFromBytes([]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04})
	AuthContractAddress, _       = common.AddressParseFromBytes([]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06})
	GovernanceContractAddress, _ = common.AddressParseFromBytes([]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07})
)
View Source
var (
	TIME_INTERVAL     = constants.UNBOUND_TIME_INTERVAL
	GENERATION_AMOUNT = constants.UNBOUND_GENERATION_AMOUNT
)

Functions

func AddCommonEvent

func AddCommonEvent(native *native.NativeService, contract common.Address, name string, params interface{})

func CalcUnbindOng

func CalcUnbindOng(balance uint64, startOffset, endOffset uint32) uint64

startOffset : start timestamp offset from genesis block endOffset : end timestamp offset from genesis block

func ConcatKey

func ConcatKey(contract common.Address, args ...[]byte) []byte

func DecodeAddress added in v1.0.3

func DecodeAddress(source *common.ZeroCopySource) (common.Address, error)

func DecodeVarUint added in v1.0.3

func DecodeVarUint(source *common.ZeroCopySource) (uint64, error)

func EncodeAddress added in v1.0.3

func EncodeAddress(sink *common.ZeroCopySink, addr common.Address) (size uint64)

func EncodeVarUint added in v1.0.3

func EncodeVarUint(sink *common.ZeroCopySink, value uint64) (size uint64)

func GenUInt32StorageItem

func GenUInt32StorageItem(value uint32) *cstates.StorageItem

func GenUInt64StorageItem

func GenUInt64StorageItem(value uint64) *cstates.StorageItem

func GetStorageItem

func GetStorageItem(native *native.NativeService, key []byte) (*cstates.StorageItem, error)

func GetStorageUInt32

func GetStorageUInt32(native *native.NativeService, key []byte) (uint32, error)

func GetStorageUInt64

func GetStorageUInt64(native *native.NativeService, key []byte) (uint64, error)

func LinkedlistDelete

func LinkedlistDelete(native *native.NativeService, index []byte, item []byte) (bool, error)

func LinkedlistGetHead

func LinkedlistGetHead(native *native.NativeService, index []byte) ([]byte, error)

func LinkedlistGetNumOfItems

func LinkedlistGetNumOfItems(native *native.NativeService, index []byte) (int, error)

func LinkedlistInsert

func LinkedlistInsert(native *native.NativeService, index []byte, item []byte, payload []byte) error

func PutBytes

func PutBytes(native *native.NativeService, key []byte, value []byte)

func ReadAddress

func ReadAddress(r io.Reader) (common.Address, error)

func ReadVarUint

func ReadVarUint(r io.Reader) (uint64, error)

func ValidateOwner

func ValidateOwner(native *native.NativeService, address common.Address) error

func WriteAddress

func WriteAddress(w io.Writer, address common.Address) error

func WriteVarUint

func WriteVarUint(w io.Writer, value uint64) error

Types

type LinkedlistNode

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

func LinkedlistGetItem

func LinkedlistGetItem(native *native.NativeService, index []byte, item []byte) (*LinkedlistNode, error)

func (*LinkedlistNode) Deserialize

func (this *LinkedlistNode) Deserialize(r []byte) error

func (*LinkedlistNode) GetNext

func (this *LinkedlistNode) GetNext() []byte

func (*LinkedlistNode) GetPayload

func (this *LinkedlistNode) GetPayload() []byte

func (*LinkedlistNode) GetPrevious

func (this *LinkedlistNode) GetPrevious() []byte

func (*LinkedlistNode) Serialize

func (this *LinkedlistNode) Serialize() ([]byte, error)

Jump to

Keyboard shortcuts

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