// Invoke
// All future requests named invoke will arrive here.

Invoke
All future requests named invoke will arrive here.
// Invoke // All future requests named invoke will arrive here .
func (t *HeroesServiceChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
	fmt.Println("########### HeroesServiceChaincode Invoke ###########")
	function, args := stub.GetFunctionAndParameters()
	if function != "invoke" {
		return shim.Error("Unknown function call")
	}
	if len(args) < 1 {
		return shim.Error("The number of arguments is insufficient.")
	}
	if args[0] == "query" {
		return t.getHistoryForMarble(stub, args)
	}
	if args[0] == "invoke" {
		return t.invoke(stub, args)
	}
	if args[0] == "init" {
		return t.init(stub, args)
	}
	return shim.Error("Unknown action, check the first argument")
}
func ( t * HeroesServiceChaincode ) Invoke ( stub shim . ChaincodeStubInterface ) pb . Response { fmt . Println ( " " ) function , args := stub . GetFunctionAndParameters ( ) if function != " " { return shim . Error ( " " ) } if len ( args ) < 1 { return shim . Error ( " " ) } if args [ 0 ] == " " { return t . getHistoryForMarble ( stub , args ) } if args [ 0 ] == " " { return t . invoke ( stub , args ) } if args [ 0 ] == " " { return t . init ( stub , args ) } return shim . Error ( " " ) }
Invoke
All future requests named invoke will arrive here.
Invoke All future requests named invoke will arrive here .
// Get the function and arguments from the request
 // Check whether it is an invoke request
 // Check whether the number of arguments is sufficient
 // In order to manage multiple type of request, we will check the first argument.
 // Here we have one possible argument: query (every query request will read in the ledger without modification)
 //return t.query(stub, args)
 // The update argument will manage all update in the ledger
 // setting an entity state
 // If the arguments given don’t match any function, we return an error
