-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3568516
commit de52035
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package chaincode | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hyperledger/fabric-chaincode-go/shim" | ||
"github.com/hyperledger/fabric-private-chaincode/ecc/chaincode" | ||
) | ||
|
||
var SingleKey = "SingleKey" | ||
|
||
type SKVSWrapper struct { | ||
*chaincode.EnclaveChaincode | ||
} | ||
|
||
type skvsStub struct { | ||
shim.ChaincodeStubInterface | ||
} | ||
|
||
func (s *skvsStub) GetState(key string) ([]byte, error) { | ||
fmt.Printf("Inside SKVS solution, GetState, key=%s\n", key) | ||
return s.ChaincodeStubInterface.GetState(SingleKey) | ||
// return s.ChaincodeStubInterface.GetState(key) | ||
} | ||
|
||
func (s *skvsStub) PutState(key string, value []byte) error { | ||
fmt.Printf("Inside SKVS solution, PutState, key=%s, value=%x\n", key, value) | ||
return s.ChaincodeStubInterface.PutState(SingleKey, value) | ||
// return s.ChaincodeStubInterface.PutState(key, value) | ||
} | ||
|
||
func (s *SKVSWrapper) GetStub() shim.ChaincodeStubInterface { | ||
// get the original stub | ||
stub := s.GetStub() | ||
fmt.Println("Inside SKVS solution, GetStub") | ||
// create a new stub with the overridden GetState() function | ||
skvsStub := &skvsStub{stub} | ||
return skvsStub | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters