complexcontract

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

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