utils

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: LGPL-3.0 Imports: 11 Imported by: 2

Documentation

Overview

SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team

  • 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/>.

SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team

  • 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}

	GasContractAddress, _        = common.AddressParseFromBytes([]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02})
	DIDContractAddress, _        = 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 DecodeBool

func DecodeBool(source *common.ZeroCopySource) (bool, error)

func DecodeString

func DecodeString(source *common.ZeroCopySource) (string, error)

func DecodeUint32

func DecodeUint32(source *common.ZeroCopySource) (uint32, error)

func DecodeUint64

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

func DecodeVarBytes

func DecodeVarBytes(source *common.ZeroCopySource) ([]byte, 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 IsNativeContract

func IsNativeContract(addr common.Address) bool

func LinkedlistDelete

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

func LinkedlistDeleteAll

func LinkedlistDeleteAll(native *native.NativeService, index []byte) 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 ValidateOwner

func ValidateOwner(native *native.NativeService, address common.Address) 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) Deserialization

func (this *LinkedlistNode) Deserialization(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) Serialization

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

Jump to

Keyboard shortcuts

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