Skip to content

Commit

Permalink
Redirect samples to fabric-{chaincode,protos}-go
Browse files Browse the repository at this point in the history
FAB-16401 #done

Change-Id: I9e6c3857cf1842ccf43d7fa0d25ff64dbeae12d0
Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
  • Loading branch information
sykesm committed Aug 23, 2019
1 parent 398a5b1 commit 1d3e267
Show file tree
Hide file tree
Showing 26 changed files with 345 additions and 1,389 deletions.
6 changes: 3 additions & 3 deletions chaincode/abac/go/abac.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"fmt"
"strconv"

"github.com/hyperledger/fabric/core/chaincode/shim/ext/cid"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/hyperledger/fabric-chaincode-go/pkg/cid"
"github.com/hyperledger/fabric-chaincode-go/shim"
pb "github.com/hyperledger/fabric-protos-go/peer"
)

// SimpleChaincode example simple Chaincode implementation
Expand Down
8 changes: 4 additions & 4 deletions chaincode/abac/go/abac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"fmt"
"testing"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/core/chaincode/shim/shimtest"
"github.com/hyperledger/fabric/protos/msp"
"github.com/gogo/protobuf/proto"
"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric-chaincode-go/shimtest"
"github.com/hyperledger/fabric-protos-go/msp"
)

// Cert with attribute. "abac.init":"true"
Expand Down
20 changes: 7 additions & 13 deletions chaincode/abac/go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ module github.com/hyperledger/fabric-samples/chaincode/abac/go
go 1.12

require (
github.com/Knetic/govaluate v3.0.0+incompatible // indirect
github.com/Shopify/sarama v1.22.1 // indirect
github.com/golang/protobuf v1.3.1
github.com/hashicorp/go-version v1.2.0 // indirect
github.com/hyperledger/fabric v2.0.0-alpha.0.20190624224950-f2b8fef8859c+incompatible
github.com/hyperledger/fabric-amcl v0.0.0-20181230093703-5ccba6eab8d6 // indirect
github.com/miekg/pkcs11 v1.0.2 // indirect
github.com/onsi/ginkgo v1.8.0 // indirect
github.com/onsi/gomega v1.5.0 // indirect
github.com/spf13/viper v1.4.0 // indirect
github.com/sykesm/zap-logfmt v0.0.2 // indirect
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 // indirect
google.golang.org/grpc v1.21.1 // indirect
github.com/gogo/protobuf v1.2.1
github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85
github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect
)
189 changes: 31 additions & 158 deletions chaincode/abac/go/go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions chaincode/abstore/go/abstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"fmt"
"strconv"

"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/hyperledger/fabric-chaincode-go/shim"
pb "github.com/hyperledger/fabric-protos-go/peer"
)

// ABstore Chaincode implementation
Expand Down
18 changes: 6 additions & 12 deletions chaincode/abstore/go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@ module github.com/hyperledger/fabric-samples/chaincode/abstore/go
go 1.12

require (
github.com/Knetic/govaluate v3.0.0+incompatible // indirect
github.com/Shopify/sarama v1.22.1 // indirect
github.com/hashicorp/go-version v1.2.0 // indirect
github.com/hyperledger/fabric v2.0.0-alpha.0.20190624224950-f2b8fef8859c+incompatible
github.com/hyperledger/fabric-amcl v0.0.0-20181230093703-5ccba6eab8d6 // indirect
github.com/miekg/pkcs11 v1.0.2 // indirect
github.com/onsi/ginkgo v1.8.0 // indirect
github.com/onsi/gomega v1.5.0 // indirect
github.com/spf13/viper v1.4.0 // indirect
github.com/sykesm/zap-logfmt v0.0.2 // indirect
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 // indirect
google.golang.org/grpc v1.21.1 // indirect
github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85
github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect
)
195 changes: 31 additions & 164 deletions chaincode/abstore/go/go.sum

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions chaincode/fabcar/go/fabcar.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import (
"fmt"
"strconv"

"github.com/hyperledger/fabric/core/chaincode/shim"
sc "github.com/hyperledger/fabric/protos/peer"
"github.com/hyperledger/fabric-chaincode-go/shim"
pb "github.com/hyperledger/fabric-protos-go/peer"
)

// Define the Smart Contract structure
Expand All @@ -54,15 +54,15 @@ type Car struct {
* The Init method is called when the Smart Contract "fabcar" is instantiated by the blockchain network
* Best practice is to have any Ledger initialization in separate function -- see initLedger()
*/
func (s *SmartContract) Init(APIstub shim.ChaincodeStubInterface) sc.Response {
func (s *SmartContract) Init(APIstub shim.ChaincodeStubInterface) pb.Response {
return shim.Success(nil)
}

/*
* The Invoke method is called as a result of an application request to run the Smart Contract "fabcar"
* The calling application program has also specified the particular smart contract function to be called, with arguments
*/
func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {
func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) pb.Response {

// Retrieve the requested Smart Contract function and arguments
function, args := APIstub.GetFunctionAndParameters()
Expand All @@ -82,7 +82,7 @@ func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response
return shim.Error("Invalid Smart Contract function name.")
}

func (s *SmartContract) queryCar(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {
func (s *SmartContract) queryCar(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {

if len(args) != 1 {
return shim.Error("Incorrect number of arguments. Expecting 1")
Expand All @@ -92,7 +92,7 @@ func (s *SmartContract) queryCar(APIstub shim.ChaincodeStubInterface, args []str
return shim.Success(carAsBytes)
}

func (s *SmartContract) initLedger(APIstub shim.ChaincodeStubInterface) sc.Response {
func (s *SmartContract) initLedger(APIstub shim.ChaincodeStubInterface) pb.Response {
cars := []Car{
Car{Make: "Toyota", Model: "Prius", Colour: "blue", Owner: "Tomoko"},
Car{Make: "Ford", Model: "Mustang", Colour: "red", Owner: "Brad"},
Expand All @@ -116,7 +116,7 @@ func (s *SmartContract) initLedger(APIstub shim.ChaincodeStubInterface) sc.Respo
return shim.Success(nil)
}

func (s *SmartContract) createCar(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {
func (s *SmartContract) createCar(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {

if len(args) != 5 {
return shim.Error("Incorrect number of arguments. Expecting 5")
Expand All @@ -130,7 +130,7 @@ func (s *SmartContract) createCar(APIstub shim.ChaincodeStubInterface, args []st
return shim.Success(nil)
}

func (s *SmartContract) queryAllCars(APIstub shim.ChaincodeStubInterface) sc.Response {
func (s *SmartContract) queryAllCars(APIstub shim.ChaincodeStubInterface) pb.Response {

startKey := "CAR0"
endKey := "CAR999"
Expand Down Expand Up @@ -173,7 +173,7 @@ func (s *SmartContract) queryAllCars(APIstub shim.ChaincodeStubInterface) sc.Res
return shim.Success(buffer.Bytes())
}

func (s *SmartContract) changeCarOwner(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {
func (s *SmartContract) changeCarOwner(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {

if len(args) != 2 {
return shim.Error("Incorrect number of arguments. Expecting 2")
Expand Down
18 changes: 6 additions & 12 deletions chaincode/fabcar/go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@ module github.com/hyperledger/fabric-samples/chaincode/fabcar/go
go 1.12

require (
github.com/Knetic/govaluate v3.0.0+incompatible // indirect
github.com/Shopify/sarama v1.22.1 // indirect
github.com/hashicorp/go-version v1.2.0 // indirect
github.com/hyperledger/fabric v2.0.0-alpha.0.20190624224950-f2b8fef8859c+incompatible
github.com/hyperledger/fabric-amcl v0.0.0-20181230093703-5ccba6eab8d6 // indirect
github.com/miekg/pkcs11 v1.0.2 // indirect
github.com/onsi/ginkgo v1.8.0 // indirect
github.com/onsi/gomega v1.5.0 // indirect
github.com/spf13/viper v1.4.0 // indirect
github.com/sykesm/zap-logfmt v0.0.2 // indirect
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 // indirect
google.golang.org/grpc v1.21.1 // indirect
github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85
github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect
)
Loading

0 comments on commit 1d3e267

Please sign in to comment.