chaincode

package
v0.0.0-...-962aece Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 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 {
	Availibility int    `json:"Availibility"`
	ID           string `json:"ID"`
	Wallet       int    `json:"Wallet"`
	Latency      int    `json:"Latency"`
}

Asset describes basic details of org1 and org2 for SLA 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 in the SLA

func (*SmartContract) AddPracticalAsset

func (s *SmartContract) AddPracticalAsset(ctx contractapi.TransactionContextInterface, id string, availibility int, wallet int, latency int) error

AddPracticalAsset issues a new asset2 to the world state with given details.

func (*SmartContract) AssetExists

AssetExists returns true when asset with given ID exists in world state

func (*SmartContract) ComputeParameters

func (s *SmartContract) ComputeParameters(ctx contractapi.TransactionContextInterface) (string, error)

func (*SmartContract) DeleteAsset

DeleteAsset deletes an given asset from the world state.

func (*SmartContract) InitContract

InitContract adds a the agreed parameter of the SLA to the ledger

func (*SmartContract) ReadAsset

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

func (*SmartContract) TransferRefund

func (s *SmartContract) TransferRefund(ctx contractapi.TransactionContextInterface, id string, refund int) (int, error)

TransferRefund updates the wallet field of asset2 with given id in world state, and returns the oldWallet.

func (*SmartContract) UpdateAsset

func (s *SmartContract) UpdateAsset(ctx contractapi.TransactionContextInterface, id string, availibility int, wallet int, latency 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