MCPcopy
hub / github.com/yeasy/blockchain_guide / ChangeStatus

Method ChangeStatus

11_app_dev/chaincode_example05.go:135–152  ·  view source on GitHub ↗
(ctx contractapi.TransactionContextInterface, address string, signature string, status string)

Source from the content-addressed store, hash-verified

133}
134
135func (s *SmartContract) ChangeStatus(ctx contractapi.TransactionContextInterface, address string, signature string, status string) (*Home, error) {
136 if !validSignature(address, signature) {
137 return nil, fmt.Errorf("invalid owner signature")
138 }
139 statusValue, err := parseNonNegativeAmount(status)
140 if err != nil {
141 return nil, err
142 }
143 home, err := readHome(ctx, address)
144 if err != nil {
145 return nil, err
146 }
147 home.Status = statusValue
148 if err := putHome(ctx, home); err != nil {
149 return nil, err
150 }
151 return home, nil
152}
153
154func (s *SmartContract) GetHomeByAddress(ctx contractapi.TransactionContextInterface, address string) (*Home, error) {
155 return readHome(ctx, address)

Callers

nothing calls this directly

Calls 4

readHomeFunction · 0.85
putHomeFunction · 0.85
validSignatureFunction · 0.70
parseNonNegativeAmountFunction · 0.70

Tested by

no test coverage detected