December 2018
Intermediate to advanced
222 pages
6h 6m
English
AddCompany is similar to how we added insuree at the Init step. Chaincode can register brokers and insurers through this function. The company type can be a broker or insurer, as follows:
func (c *ClaimContract) AddCompany(stub shim.ChaincodeStubInterface, args []string) pb.Response { id := args[0] name := args[1] companyType := args[2] companyData := Company{ Id: id, Type: companyType, Name: name} companyBytes, _ := json.Marshal(companyData) stub.PutState(id, companyBytes) return shim.Success(companyBytes)}
Read now
Unlock full access