Documentation
¶
Index ¶
- type Asset
- type SmartContract
- func (s *SmartContract) AddPracticalAsset(ctx contractapi.TransactionContextInterface, id string, availibility int, ...) error
- func (s *SmartContract) AssetExists(ctx contractapi.TransactionContextInterface, id string) (bool, error)
- func (s *SmartContract) ComputeParameters(ctx contractapi.TransactionContextInterface) (string, error)
- func (s *SmartContract) DeleteAsset(ctx contractapi.TransactionContextInterface, id string) error
- func (s *SmartContract) InitContract(ctx contractapi.TransactionContextInterface) error
- func (s *SmartContract) ReadAsset(ctx contractapi.TransactionContextInterface, id string) (*Asset, error)
- func (s *SmartContract) TransferRefund(ctx contractapi.TransactionContextInterface, id string, refund int) (int, error)
- func (s *SmartContract) UpdateAsset(ctx contractapi.TransactionContextInterface, id string, availibility int, ...) error
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 ¶
func (s *SmartContract) AssetExists(ctx contractapi.TransactionContextInterface, id string) (bool, error)
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 ¶
func (s *SmartContract) DeleteAsset(ctx contractapi.TransactionContextInterface, id string) error
DeleteAsset deletes an given asset from the world state.
func (*SmartContract) InitContract ¶
func (s *SmartContract) InitContract(ctx contractapi.TransactionContextInterface) error
InitContract adds a the agreed parameter of the SLA to the ledger
func (*SmartContract) ReadAsset ¶
func (s *SmartContract) ReadAsset(ctx contractapi.TransactionContextInterface, id string) (*Asset, error)
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.