utils

package
v0.0.0-...-f5d07b1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: LGPL-3.0 Imports: 11 Imported by: 0

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

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

func DecodeVarUint

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

func EncodeAddress

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

func EncodeVarUint

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