complexcontract

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 6 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicObject

type BasicObject struct {
	ID        string     `json:"id"`
	Owner     BasicOwner `json:"owner"`
	Value     uint       `json:"value"`
	Condition int        `json:"condition"`
	Colours   []string   `json:"colours"`
}

BasicObject a basic object

func (*BasicObject) SetConditionNew

func (ba *BasicObject) SetConditionNew()

SetConditionNew set the condition of the object to mark as new

func (*BasicObject) SetConditionUsed

func (ba *BasicObject) SetConditionUsed()

SetConditionUsed set the condition of the object to mark as used

type BasicOwner

type BasicOwner struct {
	Name    string `json:"name"`
	Contact string `json:"contact"`
}

BasicOwner details about an owner

type ComplexContract

type ComplexContract struct {
	contractapi.Contract
}

ComplexContract contract for handling the business logic of a basic object

func (*ComplexContract) GetObject

GetObject returns the object with id given from the world state

func (*ComplexContract) GetValue

GetValue returns the value from the object with id given from the world state

func (*ComplexContract) NewObject

func (c *ComplexContract) NewObject(ctx utils.CustomTransactionContextInterface, id string, owner BasicOwner, value uint, colours []string) error

NewObject adds a new basic object to the world state using id as key

func (*ComplexContract) UpdateOwner

UpdateOwner changes the ownership of a basic object and mark it as used

func (*ComplexContract) UpdateValue

func (c *ComplexContract) UpdateValue(ctx utils.CustomTransactionContextInterface, id string, valueAdd int) error

UpdateValue changes the value of a basic object to add the value passed

Jump to

Keyboard shortcuts

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