Skip to content

Commit 8cccdc2

Browse files
authored
Merge pull request #35 from corda/AdvancedSamplesRevamp
Merge advanced folder into Q4cleanup
2 parents 1716b6e + 606db07 commit 8cccdc2

File tree

21 files changed

+67
-138
lines changed

21 files changed

+67
-138
lines changed

Advanced/README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1-
## samples-java/advanced-cordapps
1+
## Advanced Cordapp Samples
22

33
This folder features Advanced sample projects, each of them demonstrates a complex cordapp that uses multiple features of Corda.
44

5-
### [auction cordapp](./auction-cordapp):
5+
### [Auction Cordapp](./auction-cordapp):
66
An blockchain application that leverages different features of Corda like [SchedulableState](https://docs.corda.net/docs/corda-os/event-scheduling.html#how-to-implement-scheduled-events), [StatePointer](https://docs.corda.net/docs/corda-os/api-states.html#state-pointers)
77
and [OwnableState](https://docs.corda.net/docs/corda-os/api-states.html#ownablestate). It also demonstrates how to perform a DvP (Delivery vs Payment) transaction on Corda.
8-
[<img src="../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Advanced/auction-cordapp)
8+
<p align="center">
9+
<img src="./auction-cordapp/snaps/setup.png" alt="Corda" width="600">
10+
</p>
911

10-
### [negotiation cordapp](./negotiation-cordapp):
12+
13+
### [Negotiation Cordapp](./negotiation-cordapp):
1114
An application that depicts the businsess negotiation and communication process over a distributed ledger system.
1215
It consists of the proposing, negotiating, and settling a corda transaction.
13-
[<img src="../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Advanced/negotiation-cordapp)
1416

15-
### [obligation cordapp](./obligation-cordapp):
17+
### [Obligation Cordapp](./obligation-cordapp):
1618
A simple i-owe-you application illustrates all of the steps of creating an obligation for a resource to change owners.
17-
[<img src="../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Advanced/obligation-cordapp)
1819

20+
### [Secret Santa Cordapp](./secretsanta-cordapp):
21+
This is an imlementation of Secret Santa using Corda as a tool to store multiple game states.It has a material-ui frontend that lets users create and self-service their own secret santa games. The frontend is implemented in ReactJS and the backend is implemented with a Spring Boot server and some corda flows. It is also equipped with an external emailing package(sendgrid), which you can utilze and turn the app into a live app and send the secret santa assignments to your friends'
22+
emails.
1923

24+
### [Snake and Ladder Game Cordapp](./snakesandladders-cordapp):
25+
This sample implements a simple Snakes And Ladder Game on Corda. This cordapp demonstrate the use of multiple features, including Corda Account Library and Oracle service.
26+
<p align="center">
27+
<img src="./snakesandladders-cordapp/snaps/game.png" alt="Corda" width="500">
28+
</p>

Advanced/auction-cordapp/README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# auction cordapp [<img src="../../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Advanced/auction-cordapp)
1+
# Auction Cordapp
22

33
This CorDapp serves as a demo of building an auction application on Corda. It leverages
44
different features of Corda like [SchedulableState](https://docs.corda.net/docs/corda-os/event-scheduling.html#how-to-implement-scheduled-events), [StatePointer](https://docs.corda.net/docs/corda-os/api-states.html#state-pointers) and [OwnableState](https://docs.corda.net/docs/corda-os/api-states.html#ownablestate). It also demonstrate
@@ -37,19 +37,19 @@ ownership. Left black for simplicity. Has two commands, `CreateAsset` and `Trans
3737

3838
### Flows:
3939

40-
- `CreateAssetFlow`: This flow is used create an asset. Implemented in [CreateAssetFlow.java](./workflows/src/main/java/net/corda/samples/flows/CreateAssetFlow.java#L44-L66)
40+
- `CreateAssetFlow`: This flow is used create an asset. Implemented in `CreateAssetFlow.java`
4141

42-
- `CreateAuctionFlow`: This flow is used to create an auction ([CreateAuctionFlow.java can be found here](./workflows/src/main/java/net/corda/samples/flows/CreateAuctionFlow.java#L58-L96)). Once an asset has been created using
42+
- `CreateAuctionFlow`: This flow is used to create an auction. Once an asset has been created using
4343
the`CreateAssetFlow`, this flow can be used to put the asset on auction. The `AuctionState`
4444
references to the `Asset` using a `StatePointer`.
4545

4646
Refer here to learn more about StatePointer: https://medium.com/corda/linking-corda-states-using-statepointer-16e24e5e602
4747

4848
- `BidFlow`: It is used to place a bid on an auction. Bids can be placed only till a predetermined
49-
deadline defined in the `AuctionState`. Implemented in [BidFlow.java](./workflows/src/main/java/net/corda/samples/flows/BidFlow.java#L42-L86).
49+
deadline defined in the `AuctionState`. Implemented in `BidFlow.java`.
5050

5151
- `EndAuctionFlow`: This is a scheduled flow, which run automatically on auction deadline to mark
52-
the corresponding auction as inactive, so that it stop receiving bids.The auction flow can be found [here](./workflows/src/main/java/net/corda/samples/flows/EndAuctionFlow.java#L39-L83)
52+
the corresponding auction as inactive, so that it stop receiving bids.
5353

5454
- `AuctionSettlementFlow`: It is used to settle an auction once the bidding deadline has passed. It internally triggers two flows:
5555

@@ -63,10 +63,9 @@ the corresponding auction as inactive, so that it stop receiving bids.The auctio
6363

6464

6565
## Usage
66+
## Pre-Requisites
67+
For development environment setup, please refer to: [Setup Guide](https://docs.corda.net/getting-set-up.html).
6668

67-
### Pre-requisites:
68-
69-
See https://docs.corda.net/getting-set-up.html.
7069

7170
### Running the nodes:
7271
Open a terminal and go to the project root directory and type: (to deploy the nodes using bootstrapper)

Advanced/negotiation-cordapp/README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# negotiation cordapp [<img src="../../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Advanced/negotiation-cordapp)
1+
# Negotiation Cordapp
22

33
This CorDapp shows how multi-party negotiation is handled on the Corda ledger, in the absence of an API for user
44
interaction.
@@ -16,21 +16,20 @@ accept or modify the proposal, this attempt will be rejected automatically at th
1616

1717
### Flows
1818

19-
We start with the proposal flow implemented in [ProposalFlow.java](./workflows/src/main/java/negotiation/flows/ProposalFlow.java)
19+
We start with the proposal flow implemented in `ProposalFlow.java`.
2020

2121

22-
The modification of the proposal is implemented in [ModificationFlow.java](./workflows/src/main/java/negotiation/flows/ModificationFlow.java#L42-L49).
22+
The modification of the proposal is implemented in `ModificationFlow.java`.
2323

2424

25-
In the [AcceptanceFlow.java](./workflows/src/main/java/negotiation/flows/AcceptanceFlow.java#L42-L75), we receive the modified ProposalState and it's converted into a TradeState.
25+
In the `AcceptanceFlow.java`, we receive the modified ProposalState and it's converted into a TradeState.
2626

2727

2828

2929
## Usage
30+
## Pre-Requisites
31+
For development environment setup, please refer to: [Setup Guide](https://docs.corda.net/getting-set-up.html).
3032

31-
### Pre-requisites:
32-
33-
See https://docs.corda.net/getting-set-up.html.
3433

3534

3635
### Running the nodes:

Advanced/obligation-cordapp/README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
1-
# obligation-cordap [<img src="../../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Advanced/obligation-cordapp)
1+
# Obligation Cordap
22

33
This Cordapp is the complete implementation of our signature IOU (I-owe-you) demonstration.
44

55
## Concepts
66

7-
An IOU is someone who has cash that is paying it back to someone they owe it to.
8-
9-
You have to have the original concept of the debt itself, (the IOU), and the cash.
10-
11-
Then the ability to exchange assets like cash or assets, and then the ability to settle up.
12-
13-
Given this is intended to implement an IOU, our cordapp consists of three flows `issue`, `transfer` and `settle` flows.
7+
An IOU is someone who has cash that is paying it back to someone they owe it to. You have to have the original concept of the debt itself, (the IOU), and the cash. Then the ability to exchange assets like cash or assets, and then the ability to settle up. Given this is intended to implement an IOU, our cordapp consists of three flows `issue`, `transfer` and `settle` flows.
148

159

1610
### Flows
1711

18-
The first flows are the ones that issue the original cash and assets. You can find that the cash flow [here](./workflows/src/main/java/net/corda/samples/flows/SelfIssueCashFlow.java#L24-L32) and the IOU issurance in [IOUIssueFlow.java](./workflows/src/main/java/net/corda/samples/flows/IOUIssueFlow.java#L40-L80).
12+
The first flows are the ones that issue the original cash and assets. You can find that the cash flow at `SelfIssueCashFlow.java` and the IOU issurance in `IOUIssueFlow.java`.
1913

20-
The next flow is the one that transfers ownership of that asset over to another party. That can be found in [IOUTransferFlow.java](./workflows/src/main/java/net/corda/samples/flows/IOUTransferFlow.java#L132-L159).
14+
The next flow is the one that transfers ownership of that asset over to another party. That can be found in `IOUTransferFlow.java`.
2115

2216

23-
Finally, once we have the ability to transfer assets, we just need to settle up. That functiionality can be found here in [IOUSettleFlow.java](./workflows/src/main/java/net/corda/samples/flows/IOUSettleFlow.java#L54-L116)
17+
Finally, once we have the ability to transfer assets, we just need to settle up. That functiionality can be found here in `IOUSettleFlow.java`
2418

2519

2620

Advanced/secretsanta-cordapp/build.gradle

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript { //properties that you need to build the project
22
Properties constants = new Properties()
3-
file("$projectDir/./constants.properties").withInputStream { constants.load(it) }
3+
file("$projectDir/../constants.properties").withInputStream { constants.load(it) }
44

55
ext {
66
corda_release_group = constants.getProperty("cordaReleaseGroup")
@@ -108,21 +108,6 @@ dependencies {
108108
cordaCompile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}"
109109
}
110110

111-
//Task to build the jar for ganache.
112-
task ganache {
113-
subprojects {
114-
if (it.project.name != "clients") {
115-
dependsOn jar
116-
doLast {
117-
copy {
118-
from "${buildDir}/libs"
119-
into "${rootDir}/build/libs"
120-
}
121-
}
122-
}
123-
}
124-
}
125-
126111
//Task to deploy the nodes in order to bootstrap a network
127112
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
128113

Advanced/secretsanta-cordapp/constants.properties

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
name=Test
1+
name=Secret Santa
22
group=com.secretsanta
33
version=0.1

Advanced/snakesandladders-cordapp/.gitignore

Lines changed: 0 additions & 12 deletions
This file was deleted.

Advanced/snakesandladders-cordapp/build.gradle

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ allprojects {
4949
jcenter()
5050
mavenCentral()
5151
maven { url 'https://software.r3.com/artifactory/corda' }
52+
maven { url 'https://jitpack.io' }
53+
//SDK lib
5254
maven { url 'https://software.r3.com/artifactory/corda-lib' }
53-
maven { url 'https://software.r3.com/artifactory/corda-lib-dev' }
54-
maven { url "https://repo.gradle.org/gradle/libs-releases-local" }
55+
//Gradle Plugins
56+
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
5557
}
5658

5759
tasks.withType(JavaCompile) {
@@ -103,29 +105,6 @@ dependencies {
103105
cordapp "$accounts_release_group:accounts-workflows:$accounts_release_version"
104106
}
105107

106-
cordapp {
107-
info {
108-
name "CorDapp Snakes And Ladders"
109-
vendor "Corda Open Source"
110-
targetPlatformVersion corda_platform_version
111-
minimumPlatformVersion corda_platform_version
112-
}
113-
}
114-
115-
task ganache {
116-
subprojects {
117-
if (it.project.name != "clients") {
118-
dependsOn jar
119-
doLast {
120-
copy {
121-
from "${buildDir}/libs"
122-
into "${rootDir}/build/libs"
123-
}
124-
}
125-
}
126-
}
127-
}
128-
129108
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
130109
nodeDefaults {
131110
projectCordapp {
@@ -182,6 +161,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
182161
cordapp project(":oracle-flows")
183162
}
184163
}
164+
185165
task installQuasar(type: Copy) {
186166
destinationDir rootProject.file("lib")
187167
from(configurations.quasar) {

Advanced/snakesandladders-cordapp/contracts/src/main/java/net/corda/sample/snl/contracts/BoardConfigContract.java renamed to Advanced/snakesandladders-cordapp/contracts/src/main/java/net/corda/samples/snl/contracts/BoardConfigContract.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package net.corda.sample.snl.contracts;
1+
package net.corda.samples.snl.contracts;
22

33
import net.corda.core.contracts.CommandData;
44
import net.corda.core.contracts.Contract;
55
import net.corda.core.transactions.LedgerTransaction;
6-
import net.corda.sample.snl.states.BoardConfig;
6+
import net.corda.samples.snl.states.BoardConfig;
77
import org.jetbrains.annotations.NotNull;
88

99
public class BoardConfigContract implements Contract {
10-
public static String ID = "net.corda.sample.snl.contracts.BoardConfigContract";
10+
public static String ID = "BoardConfigContract";
1111

1212
@Override
1313
public void verify(@NotNull LedgerTransaction tx) throws IllegalArgumentException {

0 commit comments

Comments
 (0)