smartcontract

package
v0.0.0-...-190a898 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2018 License: LGPL-3.0-or-later Imports: 9 Imported by: 0

Documentation

Overview

This file is part of the Dazzle Gravity library.

The Dazzle Gravity library 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 Dazzle Gravity library 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 Dazzle Gravity library. If not, see <e <http://www.gnu.org/licenses/>./>.

This file is part of the Dazzle Gravity library.

The Dazzle Gravity library 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 Dazzle Gravity library 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 Dazzle Gravity library. If not, see <e <http://www.gnu.org/licenses/>./>.

This file is part of the Dazzle Gravity library.

The Dazzle Gravity library 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 Dazzle Gravity library 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 Dazzle Gravity library. If not, see <e <http://www.gnu.org/licenses/>./>.

Index

Constants

View Source
const (
	//ErrNotFoundFormDB is not found in the database
	ErrNotFoundFormDB = iota
	//ErrPutDB was an insert database failure
	ErrPutDB
	//ErrDeleteDB was a failed delete database
	ErrDeleteDB
	//ErrForEachDB is traversal failure
	ErrForEachDB
)

Variables

This section is empty.

Functions

func CreateSmartContractBucket

func CreateSmartContractBucket(db database.Db) error

CreateSmartContractBucket is the bucket associated with creating smart contracts

func IsNotFoundFormDBError

func IsNotFoundFormDBError(smartContractError *SmartContractError) bool

IsNotFoundFormDBError is that this error does not exist

Types

type ContractLibrary

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

ContractLibrary is a database read-write class

func NewContractLibrary

func NewContractLibrary(tx database.Tx, readOnly bool) *ContractLibrary

NewContractLibrary is to create a new object to access contract database

func (*ContractLibrary) HasAsset

func (library *ContractLibrary) HasAsset(asset hash.HashType) bool

HasAsset is to check if current asset is exist in the database

func (*ContractLibrary) HasAssetContract

func (library *ContractLibrary) HasAssetContract(asset hash.HashType, addr hash.HashType) bool

HasAssetContract is to check if current asset contract is exist in the database

func (*ContractLibrary) HasContract

func (library *ContractLibrary) HasContract(address hash.HashType) bool

HasContract returns if the contract is existed

func (*ContractLibrary) ListContracts

func (library *ContractLibrary) ListContracts() ([]hash.HashType, error)

ListContracts list contracts according to hashes

func (*ContractLibrary) LoadAsset

func (library *ContractLibrary) LoadAsset(assetHash hash.HashType) (*structure.IssueMessage, uint64, error)

LoadAsset is to read asset

func (*ContractLibrary) LoadAssetContract

func (library *ContractLibrary) LoadAssetContract(asset hash.HashType, addr hash.HashType) (*structure.ContractDef, *structure.Contract, error)

LoadAssetContract is to read a contract associate with current asset

func (*ContractLibrary) LoadAssetContractDef

func (library *ContractLibrary) LoadAssetContractDef(asset hash.HashType, addr hash.HashType) (*structure.ContractDef, error)

LoadAssetContractDef is to read contract definition associate with asset

func (*ContractLibrary) LoadContract

func (library *ContractLibrary) LoadContract(address hash.HashType) (*structure.Contract, uint64, error)

LoadContract is to read contract according to the address

func (*ContractLibrary) RemoveAsset

func (library *ContractLibrary) RemoveAsset(asset hash.HashType) error

RemoveAsset is to remove asset

func (*ContractLibrary) RemoveAssetContract

func (library *ContractLibrary) RemoveAssetContract(asset hash.HashType, address hash.HashType) error

RemoveAssetContract is to remove a contract associate with asset

func (*ContractLibrary) RemoveContract

func (library *ContractLibrary) RemoveContract(address hash.HashType) error

RemoveContract is to remove contract from database

func (*ContractLibrary) SaveAsset

func (library *ContractLibrary) SaveAsset(unithash hash.HashType, asset *structure.IssueMessage, mci uint64) error

SaveAsset is to store asset

func (*ContractLibrary) SaveAssetContractDef

func (library *ContractLibrary) SaveAssetContractDef(asset hash.HashType, contractDef *structure.ContractDef) error

SaveAssetContractDef is to store all contracts definition associated with asset

func (*ContractLibrary) SaveContract

func (library *ContractLibrary) SaveContract(contract *structure.Contract, mci uint64) error

SaveContract is used to store contract to database

type SmartContractError

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

SmartContractError is the wrong structure associated with smart contracts

func NewSmartContractError

func NewSmartContractError(code uint32, des string, err error) *SmartContractError

NewSmartContractError is creating a new error object

func (*SmartContractError) Error

func (e *SmartContractError) Error() string

Error is the error type converted to string type

Directories

Path Synopsis
internal
dbnamespace
This file is part of the Dazzle Gravity library.
This file is part of the Dazzle Gravity library.
vm
This file is part of the Dazzle Gravity library.
This file is part of the Dazzle Gravity library.
lispvm
This file is part of the Dazzle Gravity library.
This file is part of the Dazzle Gravity library.

Jump to

Keyboard shortcuts

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