mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-23 01:55:10 +00:00
Added library-tracker folder
This commit is contained in:
parent
e111da1363
commit
156559b0ef
172 changed files with 10976 additions and 410 deletions
|
|
@ -1,61 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>commercial-paper</groupId>
|
||||
<artifactId>commercial-paper</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>hyperledger</id>
|
||||
<name>Hyperledger Artifactory</name>
|
||||
<url>https://hyperledger.jfrog.io/hyperledger/fabric-maven</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<fabric-chaincode-java.version>1.4.2</fabric-chaincode-java.version>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>commercial-paper</groupId>
|
||||
<artifactId>commercial-paper</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>hyperledger</id>
|
||||
<name>Hyperledger Artifactory</name>
|
||||
<url>https://hyperledger.jfrog.io/hyperledger/fabric-maven</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<fabric-chaincode-java.version>1.4.2</fabric-chaincode-java.version>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
0
library-tracker/organization/digibank/contract-java/gradlew → library-tracker/organization/bullard-sanford/contract-java/gradlew
vendored
Executable file → Normal file
0
library-tracker/organization/digibank/contract-java/gradlew → library-tracker/organization/bullard-sanford/contract-java/gradlew
vendored
Executable file → Normal file
|
|
@ -1,84 +1,84 @@
|
|||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
|
@ -1,61 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>commercial-paper</groupId>
|
||||
<artifactId>commercial-paper</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>hyperledger</id>
|
||||
<name>Hyperledger Artifactory</name>
|
||||
<url>https://hyperledger.jfrog.io/hyperledger/fabric-maven</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<fabric-chaincode-java.version>1.4.2</fabric-chaincode-java.version>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>commercial-paper</groupId>
|
||||
<artifactId>commercial-paper</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>hyperledger</id>
|
||||
<name>Hyperledger Artifactory</name>
|
||||
<url>https://hyperledger.jfrog.io/hyperledger/fabric-maven</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<fabric-chaincode-java.version>1.4.2</fabric-chaincode-java.version>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.magnetocorp;
|
||||
package org.digibank;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
|
@ -18,19 +18,19 @@ public class AddToWallet {
|
|||
public static void main(String[] args) {
|
||||
try {
|
||||
// A wallet stores a collection of identities
|
||||
Path walletPath = Paths.get("..", "identity", "user", "isabella", "wallet");
|
||||
Path walletPath = Paths.get("..", "identity", "user", "balaji", "wallet");
|
||||
Wallet wallet = Wallet.createFileSystemWallet(walletPath);
|
||||
|
||||
// Location of credentials to be stored in the wallet
|
||||
Path credentialPath = Paths.get("..", "..",".." ,".." ,"basic-network", "crypto-config",
|
||||
"peerOrganizations", "org1.example.com", "users", "User1@org1.example.com", "msp");
|
||||
Path credentialPath = Paths.get("..", "..", "..", "..","basic-network", "crypto-config",
|
||||
"peerOrganizations", "org1.example.com", "users", "Admin@org1.example.com", "msp");
|
||||
Path certificatePem = credentialPath.resolve(Paths.get("signcerts",
|
||||
"User1@org1.example.com-cert.pem"));
|
||||
"Admin@org1.example.com-cert.pem"));
|
||||
Path privateKey = credentialPath.resolve(Paths.get("keystore",
|
||||
"c75bd6911aca808941c3557ee7c97e90f3952e379497dc55eb903f31b50abc83_sk"));
|
||||
"cd96d5260ad4757551ed4a5a991e62130f8008a0bf996e4e4b84cd097a747fec_sk"));
|
||||
|
||||
// Load credentials into wallet
|
||||
String identityLabel = "User1@org1.example.com";
|
||||
String identityLabel = "Admin@org1.example.com";
|
||||
Identity identity = Identity.createIdentity("Org1MSP", Files.newBufferedReader(certificatePem), Files.newBufferedReader(privateKey));
|
||||
|
||||
wallet.put(identityLabel, identity);
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.magnetocorp;
|
||||
package org.digibank;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
|
|
@ -17,11 +17,12 @@ import org.hyperledger.fabric.gateway.Network;
|
|||
import org.hyperledger.fabric.gateway.Wallet;
|
||||
import org.papernet.CommercialPaper;
|
||||
|
||||
public class Issue {
|
||||
public class Buy {
|
||||
|
||||
private static final String ENVKEY="CONTRACT_NAME";
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
Gateway.Builder builder = Gateway.createBuilder();
|
||||
|
||||
String contractName="papercontract";
|
||||
// get the name of the contract, in case it is overridden
|
||||
|
|
@ -30,16 +31,14 @@ public class Issue {
|
|||
contractName=envvar.get(ENVKEY);
|
||||
}
|
||||
|
||||
Gateway.Builder builder = Gateway.createBuilder();
|
||||
|
||||
try {
|
||||
// A wallet stores a collection of identities
|
||||
Path walletPath = Paths.get("..", "identity", "user", "isabella", "wallet");
|
||||
Path walletPath = Paths.get("..", "identity", "user", "balaji", "wallet");
|
||||
Wallet wallet = Wallet.createFileSystemWallet(walletPath);
|
||||
|
||||
String userName = "User1@org1.example.com";
|
||||
String userName = "Admin@org1.example.com";
|
||||
|
||||
Path connectionProfile = Paths.get("..", "gateway", "networkConnection.yaml");
|
||||
Path connectionProfile = Paths.get("..", "gateway", "networkConnection.yaml");
|
||||
|
||||
// Set connection options on the gateway builder
|
||||
builder.identity(wallet, userName).networkConfig(connectionProfile).discovery(false);
|
||||
|
|
@ -53,14 +52,14 @@ public class Issue {
|
|||
|
||||
// Get addressability to commercial paper contract
|
||||
System.out.println("Use org.papernet.commercialpaper smart contract.");
|
||||
Contract contract = network.getContract(contractName, "org.papernet.commercialpaper");
|
||||
Contract contract = network.getContract(contractName, "org.papernet.commercialpaper");
|
||||
|
||||
// Issue commercial paper
|
||||
System.out.println("Submit commercial paper issue transaction.");
|
||||
byte[] response = contract.submitTransaction("issue", "MagnetoCorp", "00001", "2020-05-31", "2020-11-30", "5000000");
|
||||
// Buy commercial paper
|
||||
System.out.println("Submit commercial paper buy transaction.");
|
||||
byte[] response = contract.submitTransaction("buy", "MagnetoCorp", "00001", "MagnetoCorp", "DigiBank", "4900000", "2020-05-31");
|
||||
|
||||
// Process response
|
||||
System.out.println("Process issue transaction response.");
|
||||
System.out.println("Process buy transaction response.");
|
||||
CommercialPaper paper = CommercialPaper.deserialize(response);
|
||||
System.out.println(paper);
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.digibank;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.hyperledger.fabric.gateway.Contract;
|
||||
import org.hyperledger.fabric.gateway.Gateway;
|
||||
import org.hyperledger.fabric.gateway.GatewayException;
|
||||
import org.hyperledger.fabric.gateway.Network;
|
||||
import org.hyperledger.fabric.gateway.Wallet;
|
||||
import org.papernet.CommercialPaper;
|
||||
|
||||
public class Redeem {
|
||||
|
||||
private static final String ENVKEY="CONTRACT_NAME";
|
||||
|
||||
public static void main(String[] args) {
|
||||
Gateway.Builder builder = Gateway.createBuilder();
|
||||
|
||||
String contractName="papercontract";
|
||||
// get the name of the contract, in case it is overridden
|
||||
Map<String,String> envvar = System.getenv();
|
||||
if (envvar.containsKey(ENVKEY)){
|
||||
contractName=envvar.get(ENVKEY);
|
||||
}
|
||||
|
||||
try {
|
||||
// A wallet stores a collection of identities
|
||||
Path walletPath = Paths.get("..", "identity", "user", "balaji", "wallet");
|
||||
Wallet wallet = Wallet.createFileSystemWallet(walletPath);
|
||||
|
||||
String userName = "Admin@org1.example.com";
|
||||
|
||||
Path connectionProfile = Paths.get("..", "gateway", "networkConnection.yaml");
|
||||
|
||||
// Set connection options on the gateway builder
|
||||
builder.identity(wallet, userName).networkConfig(connectionProfile).discovery(false);
|
||||
|
||||
// Connect to gateway using application specified parameters
|
||||
try(Gateway gateway = builder.connect()) {
|
||||
|
||||
// Access PaperNet network
|
||||
System.out.println("Use network channel: mychannel.");
|
||||
Network network = gateway.getNetwork("mychannel");
|
||||
|
||||
// Get addressability to commercial paper contract
|
||||
System.out.println("Use org.papernet.commercialpaper smart contract.");
|
||||
Contract contract = network.getContract("papercontract", "org.papernet.commercialpaper");
|
||||
|
||||
// Redeem commercial paper
|
||||
System.out.println("Submit commercial paper redeem transaction.");
|
||||
byte[] response = contract.submitTransaction("redeem", "MagnetoCorp", "00001", "DigiBank", "2020-11-30");
|
||||
|
||||
// Process response
|
||||
System.out.println("Process redeem transaction response.");
|
||||
CommercialPaper paper = CommercialPaper.deserialize(response);
|
||||
System.out.println(paper);
|
||||
}
|
||||
} catch (GatewayException | IOException | TimeoutException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +1,19 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* SPDX-License-Identifier:
|
||||
*/
|
||||
|
||||
package org.papernet;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import org.papernet.ledgerapi.State;
|
||||
import org.hyperledger.fabric.contract.annotation.DataType;
|
||||
import org.hyperledger.fabric.contract.annotation.Property;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONPropertyIgnore;
|
||||
import org.papernet.ledgerapi.State;
|
||||
|
||||
@DataType()
|
||||
public class CommercialPaper extends State {
|
||||
|
||||
// Enumerate commercial paper state values
|
||||
public final static String ISSUED = "ISSUED";
|
||||
public final static String TRADING = "TRADING";
|
||||
|
|
@ -162,8 +161,8 @@ public class CommercialPaper extends State {
|
|||
String maturityDateTime = json.getString("maturityDateTime");
|
||||
String owner = json.getString("owner");
|
||||
int faceValue = json.getInt("faceValue");
|
||||
String state = json.getString("state");
|
||||
return createInstance(issuer, paperNumber, issueDateTime, maturityDateTime, faceValue, owner, state);
|
||||
String state = json.getString("state");
|
||||
return createInstance(issuer, paperNumber, issueDateTime, maturityDateTime, faceValue,owner,state);
|
||||
}
|
||||
|
||||
public static byte[] serialize(CommercialPaper paper) {
|
||||
|
|
@ -176,8 +175,7 @@ public class CommercialPaper extends State {
|
|||
public static CommercialPaper createInstance(String issuer, String paperNumber, String issueDateTime,
|
||||
String maturityDateTime, int faceValue, String owner, String state) {
|
||||
return new CommercialPaper().setIssuer(issuer).setPaperNumber(paperNumber).setMaturityDateTime(maturityDateTime)
|
||||
.setFaceValue(faceValue).setKey().setIssueDateTime(issueDateTime).setOwner(issuer).setState(state);
|
||||
.setFaceValue(faceValue).setKey().setIssueDateTime(issueDateTime).setOwner(owner).setState(state);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ const path = require('path');
|
|||
const fixtures = path.resolve(__dirname, '../../../../basic-network');
|
||||
|
||||
// A wallet stores a collection of identities
|
||||
const wallet = new FileSystemWallet('../identity/user/isabella/wallet');
|
||||
const wallet = new FileSystemWallet('../identity/user/balaji/wallet');
|
||||
|
||||
async function main() {
|
||||
|
||||
|
|
@ -20,12 +20,12 @@ async function main() {
|
|||
try {
|
||||
|
||||
// Identity to credentials to be stored in the wallet
|
||||
const credPath = path.join(fixtures, '/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com');
|
||||
const cert = fs.readFileSync(path.join(credPath, '/msp/signcerts/User1@org1.example.com-cert.pem')).toString();
|
||||
const key = fs.readFileSync(path.join(credPath, '/msp/keystore/c75bd6911aca808941c3557ee7c97e90f3952e379497dc55eb903f31b50abc83_sk')).toString();
|
||||
const credPath = path.join(fixtures, '/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com');
|
||||
const cert = fs.readFileSync(path.join(credPath, '/msp/signcerts/Admin@org1.example.com-cert.pem')).toString();
|
||||
const key = fs.readFileSync(path.join(credPath, '/msp/keystore/cd96d5260ad4757551ed4a5a991e62130f8008a0bf996e4e4b84cd097a747fec_sk')).toString();
|
||||
|
||||
// Load credentials into wallet
|
||||
const identityLabel = 'User1@org1.example.com';
|
||||
const identityLabel = 'Admin@org1.example.com';
|
||||
const identity = X509WalletMixin.createIdentity('Org1MSP', cert, key);
|
||||
|
||||
await wallet.import(identityLabel, identity);
|
||||
102
library-tracker/organization/cannavino/application/buy.js
Normal file
102
library-tracker/organization/cannavino/application/buy.js
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
* This application has 6 basic steps:
|
||||
* 1. Select an identity from a wallet
|
||||
* 2. Connect to network gateway
|
||||
* 3. Access PaperNet network
|
||||
* 4. Construct request to issue commercial paper
|
||||
* 5. Submit transaction
|
||||
* 6. Process response
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Bring key classes into scope, most importantly Fabric SDK network class
|
||||
const fs = require('fs');
|
||||
const yaml = require('js-yaml');
|
||||
const { FileSystemWallet, Gateway } = require('fabric-network');
|
||||
const CommercialPaper = require('../../magnetocorp/contract/lib/paper.js');
|
||||
|
||||
// A wallet stores a collection of identities for use
|
||||
const wallet = new FileSystemWallet('../identity/user/balaji/wallet');
|
||||
|
||||
// Main program function
|
||||
async function main () {
|
||||
|
||||
// A gateway defines the peers used to access Fabric networks
|
||||
const gateway = new Gateway();
|
||||
|
||||
// Main try/catch block
|
||||
try {
|
||||
|
||||
// Specify userName for network access
|
||||
// const userName = 'isabella.issuer@magnetocorp.com';
|
||||
const userName = 'Admin@org1.example.com';
|
||||
|
||||
// Load connection profile; will be used to locate a gateway
|
||||
let connectionProfile = yaml.safeLoad(fs.readFileSync('../gateway/networkConnection.yaml', 'utf8'));
|
||||
|
||||
// Set connection options; identity and wallet
|
||||
let connectionOptions = {
|
||||
identity: userName,
|
||||
wallet: wallet,
|
||||
discovery: { enabled: false, asLocalhost: true }
|
||||
|
||||
};
|
||||
|
||||
// Connect to gateway using application specified parameters
|
||||
console.log('Connect to Fabric gateway.');
|
||||
|
||||
await gateway.connect(connectionProfile, connectionOptions);
|
||||
|
||||
// Access PaperNet network
|
||||
console.log('Use network channel: mychannel.');
|
||||
|
||||
const network = await gateway.getNetwork('mychannel');
|
||||
|
||||
// Get addressability to commercial paper contract
|
||||
console.log('Use org.papernet.commercialpaper smart contract.');
|
||||
|
||||
const contract = await network.getContract('papercontract', 'org.papernet.commercialpaper');
|
||||
|
||||
// buy commercial paper
|
||||
console.log('Submit commercial paper buy transaction.');
|
||||
|
||||
const buyResponse = await contract.submitTransaction('buy', 'MagnetoCorp', '00001', 'MagnetoCorp', 'DigiBank', '4900000', '2020-05-31');
|
||||
|
||||
// process response
|
||||
console.log('Process buy transaction response.');
|
||||
|
||||
let paper = CommercialPaper.fromBuffer(buyResponse);
|
||||
|
||||
console.log(`${paper.issuer} commercial paper : ${paper.paperNumber} successfully purchased by ${paper.owner}`);
|
||||
console.log('Transaction complete.');
|
||||
|
||||
} catch (error) {
|
||||
|
||||
console.log(`Error processing transaction. ${error}`);
|
||||
console.log(error.stack);
|
||||
|
||||
} finally {
|
||||
|
||||
// Disconnect from the gateway
|
||||
console.log('Disconnect from Fabric gateway.');
|
||||
gateway.disconnect();
|
||||
|
||||
}
|
||||
}
|
||||
main().then(() => {
|
||||
|
||||
console.log('Buy program complete.');
|
||||
|
||||
}).catch((e) => {
|
||||
|
||||
console.log('Buy program exception.');
|
||||
console.log(e);
|
||||
console.log(e.stack);
|
||||
process.exit(-1);
|
||||
|
||||
});
|
||||
101
library-tracker/organization/cannavino/application/getPaper.js
Normal file
101
library-tracker/organization/cannavino/application/getPaper.js
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/*
|
||||
* This application has 6 basic steps:
|
||||
* 1. Select an identity from a wallet
|
||||
* 2. Connect to network gateway
|
||||
* 3. Access PaperNet network
|
||||
* 4. Construct request to query a commercial paper
|
||||
* 5. Submit transaction
|
||||
* 6. Process response
|
||||
*/
|
||||
'use strict';
|
||||
// Bring key classes into scope, most importantly Fabric SDK network class
|
||||
const fs = require('fs');
|
||||
const yaml = require('js-yaml');
|
||||
const { FileSystemWallet, Gateway } = require('fabric-network');
|
||||
const CommercialPaper = require('../contract/lib/paper.js');
|
||||
// A wallet stores a collection of identities for use
|
||||
const wallet = new FileSystemWallet('../identity/user/balaji/wallet');
|
||||
// Main program function
|
||||
async function main() {
|
||||
// A gateway defines the peers used to access Fabric networks
|
||||
const gateway = new Gateway();
|
||||
|
||||
// Main try/catch block
|
||||
try {
|
||||
// Specify userName for network access
|
||||
// const userName = 'isabella.issuer@magnetocorp.com';
|
||||
const userName = 'Admin@org1.example.com';
|
||||
// Load connection profile; will be used to locate a gateway
|
||||
let connectionProfile = yaml.safeLoad(fs.readFileSync('../gateway/networkConnection.yaml', 'utf8'));
|
||||
// Set connection options; identity and wallet
|
||||
let connectionOptions = {
|
||||
identity: userName,
|
||||
wallet: wallet,
|
||||
discovery: { enabled:false, asLocalhost: true }
|
||||
};
|
||||
|
||||
// Connect to gateway using application specified parameters
|
||||
console.log('Connect to Fabric gateway.');
|
||||
await gateway.connect(connectionProfile, connectionOptions);
|
||||
|
||||
// Access PaperNet network
|
||||
console.log('Use network channel: mychannel.');
|
||||
const network = await gateway.getNetwork('mychannel');
|
||||
|
||||
// Get addressability to commercial paper contract
|
||||
console.log('Use org.papernet.commercialpaper smart contract.');
|
||||
const contract = await network.getContract('papercontract', 'org.papernet.commercialpaper');
|
||||
|
||||
// get commercial paper
|
||||
console.log('Submit commercial paper getPaper transaction.');
|
||||
const getPaperResponse = await contract.evaluateTransaction('getPaper', 'MagnetoCorp', '00001');
|
||||
|
||||
// process response
|
||||
console.log('Process getPaper transaction response.');
|
||||
let paperJSON = JSON.parse(getPaperResponse);
|
||||
let paper = CommercialPaper.createInstance(paperJSON.issuer, paperJSON.paperNumber, paperJSON.issueDateTime, paperJSON.maturityDateTime, paperJSON.faceValue);
|
||||
paper.setOwner(paperJSON.owner);
|
||||
paper.currentState = paperJSON.currentState;
|
||||
|
||||
// let paper = CommercialPaper.fromBuffer(getPaperResponse);
|
||||
let paperState = 'Unknown';
|
||||
if(paper.isIssued()) {
|
||||
paperState = 'ISSUED';
|
||||
} else if(paper.isTrading()){
|
||||
paperState = 'TRADING';
|
||||
} else if(paper.isRedeemed()){
|
||||
paperState = 'REDEEMED';
|
||||
}
|
||||
|
||||
console.log(` +--------- Paper Retrieved ---------+ `);
|
||||
console.log(` | Paper number: "${paper.paperNumber}"`);
|
||||
console.log(` | Paper is owned by: "${paper.owner}"`);
|
||||
console.log(` | Paper is currently: "${paperState}"`);
|
||||
console.log(` | Paper face value: "${paper.faceValue}"`);
|
||||
console.log(` | Paper is issued by: "${paper.issuer}"`);
|
||||
console.log(` | Paper issue on: "${paper.issueDateTime}"`);
|
||||
console.log(` | Paper matures on: "${paper.maturityDateTime}"`);
|
||||
console.log(` +-----------------------------------+ `);
|
||||
console.log('Transaction complete.');
|
||||
|
||||
//console.log('Transaction complete.' + JSON.stringify(paper));
|
||||
} catch (error) {
|
||||
console.log(`Error processing transaction. ${error}`);
|
||||
console.log(error.stack);
|
||||
} finally {
|
||||
// Disconnect from the gateway
|
||||
console.log('Disconnect from Fabric gateway.')
|
||||
gateway.disconnect();
|
||||
}
|
||||
}
|
||||
main().then(() => {
|
||||
console.log('getPaper program complete.');
|
||||
}).catch((e) => {
|
||||
console.log('getPaper program exception.');
|
||||
console.log(e);
|
||||
console.log(e.stack);
|
||||
process.exit(-1);
|
||||
});
|
||||
|
|
@ -548,9 +548,9 @@
|
|||
}
|
||||
},
|
||||
"eslint-utils": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.0.tgz",
|
||||
"integrity": "sha512-7ehnzPaP5IIEh1r1tkjuIrxqhNkzUJa9z3R92tLJdZIVdWaczEhr3EbhGtsMrVxi1KeR8qA7Off6SWc5WNQqyQ==",
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.2.tgz",
|
||||
"integrity": "sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"eslint-visitor-keys": "^1.0.0"
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
"name": "nodejs",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "issue.js",
|
||||
"main": "buy.js",
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "rm -rf _idwallet && node addToWallet.js && node issue.js"
|
||||
"test": "rm -rf _idwallet && node addToWallet.js && node buy.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
|
@ -21,8 +21,7 @@ const { FileSystemWallet, Gateway } = require('fabric-network');
|
|||
const CommercialPaper = require('../contract/lib/paper.js');
|
||||
|
||||
// A wallet stores a collection of identities for use
|
||||
//const wallet = new FileSystemWallet('../user/isabella/wallet');
|
||||
const wallet = new FileSystemWallet('../identity/user/isabella/wallet');
|
||||
const wallet = new FileSystemWallet('../identity/user/balaji/wallet');
|
||||
|
||||
// Main program function
|
||||
async function main() {
|
||||
|
|
@ -35,7 +34,7 @@ async function main() {
|
|||
|
||||
// Specify userName for network access
|
||||
// const userName = 'isabella.issuer@magnetocorp.com';
|
||||
const userName = 'User1@org1.example.com';
|
||||
const userName = 'Admin@org1.example.com';
|
||||
|
||||
// Load connection profile; will be used to locate a gateway
|
||||
let connectionProfile = yaml.safeLoad(fs.readFileSync('../gateway/networkConnection.yaml', 'utf8'));
|
||||
|
|
@ -60,19 +59,19 @@ async function main() {
|
|||
// Get addressability to commercial paper contract
|
||||
console.log('Use org.papernet.commercialpaper smart contract.');
|
||||
|
||||
const contract = await network.getContract('papercontract');
|
||||
const contract = await network.getContract('papercontract', 'org.papernet.commercialpaper');
|
||||
|
||||
// issue commercial paper
|
||||
console.log('Submit commercial paper issue transaction.');
|
||||
// redeem commercial paper
|
||||
console.log('Submit commercial paper redeem transaction.');
|
||||
|
||||
const issueResponse = await contract.submitTransaction('issue', 'MagnetoCorp', '00001', '2020-05-31', '2020-11-30', '5000000');
|
||||
const redeemResponse = await contract.submitTransaction('redeem', 'MagnetoCorp', '00001', 'DigiBank', '2020-11-30');
|
||||
|
||||
// process response
|
||||
console.log('Process issue transaction response.'+issueResponse);
|
||||
console.log('Process redeem transaction response.');
|
||||
|
||||
let paper = CommercialPaper.fromBuffer(issueResponse);
|
||||
let paper = CommercialPaper.fromBuffer(redeemResponse);
|
||||
|
||||
console.log(`${paper.issuer} commercial paper : ${paper.paperNumber} successfully issued for value ${paper.faceValue}`);
|
||||
console.log(`${paper.issuer} commercial paper : ${paper.paperNumber} successfully redeemed with ${paper.owner}`);
|
||||
console.log('Transaction complete.');
|
||||
|
||||
} catch (error) {
|
||||
|
|
@ -90,11 +89,11 @@ async function main() {
|
|||
}
|
||||
main().then(() => {
|
||||
|
||||
console.log('Issue program complete.');
|
||||
console.log('Redeem program complete.');
|
||||
|
||||
}).catch((e) => {
|
||||
|
||||
console.log('Issue program exception.');
|
||||
console.log('Redeem program exception.');
|
||||
console.log(e);
|
||||
console.log(e.stack);
|
||||
process.exit(-1);
|
||||
|
|
@ -0,0 +1 @@
|
|||
Suggest that you change to this dir /home/matthew/go/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/digibank
|
||||
|
|
@ -11,8 +11,8 @@ networks:
|
|||
name: net_basic
|
||||
|
||||
services:
|
||||
cliMagnetoCorp:
|
||||
container_name: cliMagnetoCorp
|
||||
cliDigiBank:
|
||||
container_name: cliDigiBank
|
||||
image: hyperledger/fabric-tools
|
||||
tty: true
|
||||
environment:
|
||||
|
|
@ -28,7 +28,7 @@ services:
|
|||
command: /bin/bash
|
||||
volumes:
|
||||
- /var/run/:/host/var/run/
|
||||
- ./../../../../organization/magnetocorp:/opt/gopath/src/github.com/
|
||||
- ./../../../../organization/digibank:/opt/gopath/src/github.com/
|
||||
- ./../../../../../basic-network/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
|
||||
networks:
|
||||
- basic
|
||||
5
library-tracker/organization/cannavino/contract-java/.gitignore
vendored
Normal file
5
library-tracker/organization/cannavino/contract-java/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
.gradle/
|
||||
build/
|
||||
bin/
|
||||
.classpath
|
||||
.settings/
|
||||
0
library-tracker/organization/magnetocorp/contract-java/gradlew → library-tracker/organization/cannavino/contract-java/gradlew
vendored
Executable file → Normal file
0
library-tracker/organization/magnetocorp/contract-java/gradlew → library-tracker/organization/cannavino/contract-java/gradlew
vendored
Executable file → Normal file
|
|
@ -1,84 +1,84 @@
|
|||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* SPDX-License-Identifier:
|
||||
*/
|
||||
|
||||
package org.example;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
|
@ -20,7 +21,7 @@ public class CommercialPaper extends State {
|
|||
public final static String REDEEMED = "REDEEMED";
|
||||
|
||||
@Property()
|
||||
private String state ="";
|
||||
private String state="";
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
|
|
@ -153,7 +154,6 @@ public class CommercialPaper extends State {
|
|||
* @param {Buffer} data to form back into the object
|
||||
*/
|
||||
public static CommercialPaper deserialize(byte[] data) {
|
||||
System.out.println("Byte data is "+ new String(data, UTF_8));
|
||||
JSONObject json = new JSONObject(new String(data, UTF_8));
|
||||
|
||||
String issuer = json.getString("issuer");
|
||||
|
|
@ -162,7 +162,7 @@ public class CommercialPaper extends State {
|
|||
String maturityDateTime = json.getString("maturityDateTime");
|
||||
String owner = json.getString("owner");
|
||||
int faceValue = json.getInt("faceValue");
|
||||
String state = json.getString("state");
|
||||
String state = json.getString("state");
|
||||
return createInstance(issuer, paperNumber, issueDateTime, maturityDateTime, faceValue,owner,state);
|
||||
}
|
||||
|
||||
|
|
@ -179,4 +179,5 @@ public class CommercialPaper extends State {
|
|||
.setFaceValue(faceValue).setKey().setIssueDateTime(issueDateTime).setOwner(owner).setState(state);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
package org.example;
|
||||
|
||||
import org.hyperledger.fabric.contract.Context;
|
||||
|
|
@ -3,7 +3,6 @@ SPDX-License-Identifier: Apache-2.0
|
|||
*/
|
||||
package org.example;
|
||||
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.example.ledgerapi.State;
|
||||
|
|
@ -40,7 +40,6 @@ public class State {
|
|||
*/
|
||||
public static byte[] serialize(Object object) {
|
||||
String jsonStr = new JSONObject(object).toString();
|
||||
System.out.println(jsonStr);
|
||||
return jsonStr.getBytes(UTF_8);
|
||||
}
|
||||
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
/*
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.example.ledgerapi;
|
||||
|
||||
@FunctionalInterface
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
|
||||
/*
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
package org.example.ledgerapi;
|
||||
|
||||
import org.example.ledgerapi.impl.StateListImpl;
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
/*
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.example.ledgerapi.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -13,6 +9,10 @@ import org.hyperledger.fabric.contract.Context;
|
|||
import org.hyperledger.fabric.shim.ChaincodeStub;
|
||||
import org.hyperledger.fabric.shim.ledger.CompositeKey;
|
||||
|
||||
/*
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* StateList provides a named virtual container for a set of ledger states. Each
|
||||
* state has a unique key which associates it with the container, rather than
|
||||
|
|
@ -74,8 +74,6 @@ public class StateListImpl implements StateList {
|
|||
CompositeKey ledgerKey = this.ctx.getStub().createCompositeKey(this.name, State.splitKey(key));
|
||||
|
||||
byte[] data = this.ctx.getStub().getState(ledgerKey.toString());
|
||||
System.out.println("Data is "+data);
|
||||
System.out.println("LedgerKey "+ledgerKey.toString());
|
||||
if (data != null) {
|
||||
State state = this.deserializer.deserialize(data);
|
||||
return state;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
* SPDX-License-Identifier: Apache License 2.0
|
||||
*/
|
||||
|
||||
package org.hyperledger.fabric.example;
|
||||
|
||||
|
|
@ -39,4 +39,19 @@ public final class CommercialPaperContractTest {
|
|||
return stub;
|
||||
}
|
||||
|
||||
@Nested
|
||||
class IssuePaper {
|
||||
// @Test
|
||||
// public void regularIssue() {
|
||||
// Response resp;
|
||||
// ChaincodeStub stub = newStub(new String[] { "issue", "issuerName", "paper001", "today", "year", "420" });
|
||||
// //
|
||||
//
|
||||
// resp = devRouter.invoke(stub);
|
||||
// assertThat(resp.getStatus()).isEqualTo(Status.SUCCESS);
|
||||
// assertThat(resp.getStringPayload()).isEqualTo("false");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
0
library-tracker/organization/magnetocorp/contract/.editorconfig → library-tracker/organization/cannavino/contract/.editorconfig
Executable file → Normal file
0
library-tracker/organization/magnetocorp/contract/.editorconfig → library-tracker/organization/cannavino/contract/.editorconfig
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue