chaincode

package
v0.0.0-...-05edea0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	AppraisedValue int    `json:"AppraisedValue"`
	Color          string `json:"Color"`
	ID             string `json:"ID"`
	Owner          string `json:"Owner"`
	Size           int    `json:"Size"`
}

Asset describes basic details of what makes up a simple asset Insert struct field in alphabetic order => to achieve determinism across languages golang keeps the order when marshal to json but doesn't order automatically

type SmartContract

type SmartContract struct {
	contractapi.Contract
}

SmartContract provides functions for managing an Asset

func (*SmartContract) CreateAsset

func (s *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface, id string, color string, size int, owner string, appraisedValue int) error

CreateAsset issues a new asset to the world state with given details.

func (*SmartContract) DeleteAsset

DeleteAsset deletes an given asset from the world state.

func (*SmartContract) ReadAsset

ReadAsset returns the asset stored in the world state with given id.

func (*SmartContract) TransferAsset

func (s *SmartContract) TransferAsset(ctx contractapi.TransactionContextInterface, id string, newOwner string) (string, error)

TransferAsset updates the owner field of asset with given id in world state, and returns the old owner.

func (*SmartContract) UpdateAsset

func (s *SmartContract) UpdateAsset(ctx contractapi.TransactionContextInterface, id string, color string, size int, owner string, appraisedValue int) error

UpdateAsset updates an existing asset in the world state with provided parameters.

Jump to

Keyboard shortcuts

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