Documentation ¶
Index ¶
- type BasicObject
- type BasicOwner
- type ComplexContract
- func (c *ComplexContract) GetObject(ctx utils.CustomTransactionContextInterface, id string) (*BasicObject, error)
- func (c *ComplexContract) GetValue(ctx utils.CustomTransactionContextInterface, id string) (uint, error)
- func (c *ComplexContract) NewObject(ctx utils.CustomTransactionContextInterface, id string, owner BasicOwner, ...) error
- func (c *ComplexContract) UpdateOwner(ctx utils.CustomTransactionContextInterface, id string, newOwner BasicOwner) error
- func (c *ComplexContract) UpdateValue(ctx utils.CustomTransactionContextInterface, id string, valueAdd int) error
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 ¶
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 ¶
func (c *ComplexContract) GetObject(ctx utils.CustomTransactionContextInterface, id string) (*BasicObject, error)
GetObject returns the object with id given from the world state
func (*ComplexContract) GetValue ¶
func (c *ComplexContract) GetValue(ctx utils.CustomTransactionContextInterface, id string) (uint, error)
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 ¶
func (c *ComplexContract) UpdateOwner(ctx utils.CustomTransactionContextInterface, id string, newOwner BasicOwner) error
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
Click to show internal directories.
Click to hide internal directories.