March 2019
Intermediate to advanced
636 pages
27h 50m
English
After we have implemented the function to create a trade agreement, we need to implement a function to accept the trade agreement. This function will retrieve the agreement, modify its status to ACCEPTED, and put it back on the ledger.
The implementation of this function is shown in the following snippet. In the code, we construct the unique composite key of the trade agreement we want to retrieve. In line 22, we retrieve the value with the function GetState. In line 33, we deserialize the array of bytes into the instance of the TradeAgreement struct. In line 41, we modify the status so it reads ACCEPTED; finally, in line 47, we store the updated value on the ledger, as follows:
func (t *TradeWorkflowChaincode) ...
Read now
Unlock full access